source("0_helpers.R")
## Warning: package 'rmarkdown' was built under R version 3.4.3
## Warning: package 'knitr' was built under R version 3.4.3
##
## Attaching package: 'formr'
## The following object is masked from 'package:rmarkdown':
##
## word_document
## Warning: package 'lubridate' was built under R version 3.4.3
##
## Attaching package: 'lubridate'
## The following object is masked from 'package:base':
##
## date
## Warning: package 'stringr' was built under R version 3.4.3
## Loading required package: carData
## lattice theme set by effectsTheme()
## See ?effectsTheme for details.
##
## Attaching package: 'data.table'
## The following objects are masked from 'package:lubridate':
##
## hour, isoweek, mday, minute, month, quarter, second, wday, week, yday, year
## The following objects are masked from 'package:formr':
##
## first, last
## Loading required package: Matrix
##
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
##
## lmer
## The following object is masked from 'package:stats':
##
## step
##
## Attaching package: 'cowplot'
## The following object is masked from 'package:ggplot2':
##
## ggsave
## Warning: package 'haven' was built under R version 3.4.3
##
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
## This is lavaan 0.5-23.1097
## lavaan is BETA software! Please report any bugs.
##
## Attaching package: 'lavaan'
## The following object is masked from 'package:psych':
##
## cor2cov
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
##
## Attaching package: 'Hmisc'
## The following object is masked from 'package:psych':
##
## describe
## The following objects are masked from 'package:base':
##
## format.pval, round.POSIXt, trunc.POSIXt, units
## Warning: package 'tidyr' was built under R version 3.4.3
##
## Attaching package: 'tidyr'
## The following object is masked from 'package:Matrix':
##
## expand
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:Hmisc':
##
## combine, src, summarize
## The following objects are masked from 'package:data.table':
##
## between, first, last
## The following objects are masked from 'package:lubridate':
##
## intersect, setdiff, union
## The following objects are masked from 'package:formr':
##
## first, last
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
## Warning: package 'coefplot' was built under R version 3.4.3
## Warning: package 'sjPlot' was built under R version 3.4.4
##
## Attaching package: 'sjPlot'
## The following objects are masked from 'package:cowplot':
##
## plot_grid, save_plot
opts_chunk$set(warning = FALSE)
birthorder = readRDS("data/alldata_birthorder.rds")
# For analyses we want to clean the dataset and get rid of all uninteresting data
birthorder = birthorder %>%
filter(!is.na(pidlink)) %>% # no individuals who are only known from the pregnancy file
filter(is.na(lifebirths) | lifebirths == 2) %>% # remove 7 and 2 individuals who are known as stillbirth or miscarriage but still have PID
select(-lifebirths) %>%
filter(!is.na(mother_pidlink)) %>%
select(-father_pidlink) %>%
filter(is.na(any_multiple_birth) | any_multiple_birth != 1) %>% # remove families with twins/triplets/..
filter(!is.na(birthorder_naive)) %>%
select(-starts_with("age_"), -wave, -any_multiple_birth, -multiple_birth) %>%
mutate(money_spent_smoking_log = if_else(is.na(money_spent_smoking_log) & ever_smoked == 0, 0, money_spent_smoking_log),
amount = if_else(is.na(amount) & ever_smoked == 0, 0, amount),
amount_still_smokers = if_else(is.na(amount_still_smokers) & still_smoking == 0, 0, amount_still_smokers),
birthyear = lubridate::year(birthdate))
# recode Factor Variable as Dummy Variable
birthorder = left_join(birthorder,
birthorder %>%
filter(!is.na(Category)) %>%
mutate(var = 1) %>%
select(pidlink, Category, var) %>%
spread(Category, var, fill = 0, sep = "_"), by = "pidlink") %>%
select(-Category)
# recode Factor Variable as Dummy Variable
birthorder = left_join(birthorder,
birthorder %>%
filter(!is.na(Sector)) %>%
mutate(var = 1) %>%
select(pidlink, Sector, var) %>%
spread(Sector, var, fill = 0, sep = "_"), by = "pidlink") %>%
select(-Sector)
### Variables
birthorder = birthorder %>%
mutate(
# center variables that are used for analysis
g_factor_2015_old = scale(g_factor_2015_old),
g_factor_2015_young = scale(g_factor_2015_young),
g_factor_2007_old = scale(g_factor_2007_old),
g_factor_2007_young = scale(g_factor_2007_young),
raven_2015_old = scale(raven_2015_old),
math_2015_old = scale(math_2015_old),
count_backwards = scale(count_backwards),
raven_2015_young = scale(raven_2015_young),
math_2015_young = scale(math_2015_young),
words_remembered_avg = scale(words_remembered_avg),
words_immediate = scale(words_immediate),
words_delayed = scale(words_delayed),
adaptive_numbering = scale(adaptive_numbering),
raven_2007_old = scale(raven_2007_old),
math_2007_old = scale(math_2007_old),
raven_2007_young = scale(raven_2007_young),
math_2007_young = scale(math_2007_young),
riskA = scale(riskA),
riskB = scale(riskB),
years_of_education_z = scale(years_of_education),
Total_score_highest_z = scale(Total_score_highest),
wage_last_month_z = scale(wage_last_month_log),
wage_last_year_z = scale(wage_last_year_log),
big5_ext = scale(big5_ext),
big5_con = scale(big5_con),
big5_agree = scale(big5_agree),
big5_open = scale(big5_open),
big5_neu = scale(big5_neu),
attended_school = as.integer(attended_school)
)
qplot(birthorder$male)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

qplot(birthorder$g_factor_2015_old)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

qplot(birthorder$g_factor_2015_old)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

### Birthorder and Sibling Count
birthorder = birthorder %>%
mutate(
# birthorder as factors with levels of 1, 2, 3, 4, 5, 5+
birthorder_naive_factor = as.character(birthorder_naive),
birthorder_naive_factor = ifelse(birthorder_naive > 5, "5+",
birthorder_naive_factor),
birthorder_naive_factor = factor(birthorder_naive_factor,
levels = c("1","2","3","4","5","5+")),
sibling_count_naive_factor = as.character(sibling_count_naive),
sibling_count_naive_factor = ifelse(sibling_count_naive > 5, "5+",
sibling_count_naive_factor),
sibling_count_naive_factor = factor(sibling_count_naive_factor,
levels = c("2","3","4","5","5+")),
birthorder_uterus_alive_factor = as.character(birthorder_uterus_alive),
birthorder_uterus_alive_factor = ifelse(birthorder_uterus_alive > 5, "5+",
birthorder_uterus_alive_factor),
birthorder_uterus_alive_factor = factor(birthorder_uterus_alive_factor,
levels = c("1","2","3","4","5","5+")),
sibling_count_uterus_alive_factor = as.character(sibling_count_uterus_alive),
sibling_count_uterus_alive_factor = ifelse(sibling_count_uterus_alive > 5, "5+",
sibling_count_uterus_alive_factor),
sibling_count_uterus_alive_factor = factor(sibling_count_uterus_alive_factor,
levels = c("2","3","4","5","5+")),
birthorder_uterus_preg_factor = as.character(birthorder_uterus_preg),
birthorder_uterus_preg_factor = ifelse(birthorder_uterus_preg > 5, "5+",
birthorder_uterus_preg_factor),
birthorder_uterus_preg_factor = factor(birthorder_uterus_preg_factor,
levels = c("1","2","3","4","5","5+")),
sibling_count_uterus_preg_factor = as.character(sibling_count_uterus_preg),
sibling_count_uterus_preg_factor = ifelse(sibling_count_uterus_preg > 5, "5+",
sibling_count_uterus_preg_factor),
sibling_count_uterus_preg_factor = factor(sibling_count_uterus_preg_factor,
levels = c("2","3","4","5","5+")),
birthorder_genes_factor = as.character(birthorder_genes),
birthorder_genes_factor = ifelse(birthorder_genes >5 , "5+", birthorder_genes_factor),
birthorder_genes_factor = factor(birthorder_genes_factor,
levels = c("1","2","3","4","5","5+")),
sibling_count_genes_factor = as.character(sibling_count_genes),
sibling_count_genes_factor = ifelse(sibling_count_genes >5 , "5+",
sibling_count_genes_factor),
sibling_count_genes_factor = factor(sibling_count_genes_factor,
levels = c("2","3","4","5","5+")),
# interaction birthorder * siblingcout for each birthorder
count_birthorder_naive =
factor(str_replace(as.character(interaction(birthorder_naive_factor, sibling_count_naive_factor)),
"\\.", "/"),
levels = c("1/2","2/2", "1/3", "2/3",
"3/3", "1/4", "2/4", "3/4", "4/4",
"1/5", "2/5", "3/5", "4/5", "5/5",
"1/5+", "2/5+", "3/5+", "4/5+",
"5/5+", "5+/5+")),
count_birthorder_uterus_alive =
factor(str_replace(as.character(interaction(birthorder_uterus_alive_factor, sibling_count_uterus_alive_factor)),
"\\.", "/"),
levels = c("1/2","2/2", "1/3", "2/3",
"3/3", "1/4", "2/4", "3/4", "4/4",
"1/5", "2/5", "3/5", "4/5", "5/5",
"1/5+", "2/5+", "3/5+", "4/5+",
"5/5+", "5+/5+")),
count_birthorder_uterus_preg =
factor(str_replace(as.character(interaction(birthorder_uterus_preg_factor, sibling_count_uterus_preg_factor)),
"\\.", "/"),
levels = c("1/2","2/2", "1/3", "2/3",
"3/3", "1/4", "2/4", "3/4", "4/4",
"1/5", "2/5", "3/5", "4/5", "5/5",
"1/5+", "2/5+", "3/5+", "4/5+",
"5/5+", "5+/5+")),
count_birthorder_genes =
factor(str_replace(as.character(interaction(birthorder_genes_factor, sibling_count_genes_factor)), "\\.", "/"),
levels = c("1/2","2/2", "1/3", "2/3",
"3/3", "1/4", "2/4", "3/4", "4/4",
"1/5", "2/5", "3/5", "4/5", "5/5",
"1/5+", "2/5+", "3/5+", "4/5+",
"5/5+", "5+/5+")))
birthorder <- birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive)
birthorder <- birthorder %>% mutate(outcome = g_factor_2015_old)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count +
(1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1911 | 0.2 | 0.9555 | -0.2009 | 0.583 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0243 | 0.02056 | 1.182 | -0.01598 | 0.06459 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.001017 | 0.0006584 | -1.544 | -0.002307 | 0.0002738 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000003728 | 0.000006632 | 0.5621 | -0.000009271 | 0.00001673 | fixed |
| male | 0.06205 | 0.01493 | 4.156 | 0.03279 | 0.09131 | fixed |
| sibling_count3 | 0.03391 | 0.03437 | 0.9865 | -0.03346 | 0.1013 | fixed |
| sibling_count4 | -0.0006889 | 0.03585 | -0.01922 | -0.07095 | 0.06957 | fixed |
| sibling_count5 | -0.001687 | 0.03755 | -0.04492 | -0.07528 | 0.07191 | fixed |
| sibling_count5+ | -0.1915 | 0.02919 | -6.56 | -0.2487 | -0.1343 | fixed |
| sd_(Intercept).mother_pidlink | 0.5824 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7438 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1824 | 0.2002 | 0.9114 | -0.2099 | 0.5748 | fixed |
| birth_order | -0.003077 | 0.00332 | -0.9269 | -0.009583 | 0.003429 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02632 | 0.02067 | 1.273 | -0.0142 | 0.06684 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.001092 | 0.0006635 | -1.646 | -0.002393 | 0.0002085 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00000448 | 0.000006683 | 0.6704 | -0.000008618 | 0.00001758 | fixed |
| male | 0.06218 | 0.01493 | 4.164 | 0.03292 | 0.09145 | fixed |
| sibling_count3 | 0.03436 | 0.03437 | 0.9997 | -0.033 | 0.1017 | fixed |
| sibling_count4 | 0.001231 | 0.0359 | 0.0343 | -0.06913 | 0.07159 | fixed |
| sibling_count5 | 0.001859 | 0.03773 | 0.04927 | -0.07209 | 0.07581 | fixed |
| sibling_count5+ | -0.18 | 0.0317 | -5.679 | -0.2422 | -0.1179 | fixed |
| sd_(Intercept).mother_pidlink | 0.582 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.744 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1974 | 0.2017 | 0.9789 | -0.1979 | 0.5928 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02456 | 0.02074 | 1.184 | -0.01608 | 0.0652 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.001027 | 0.0006661 | -1.542 | -0.002332 | 0.0002787 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000003763 | 0.000006717 | 0.5601 | -0.000009403 | 0.00001693 | fixed |
| male | 0.06205 | 0.01493 | 4.155 | 0.03278 | 0.09131 | fixed |
| sibling_count3 | 0.03503 | 0.0347 | 1.01 | -0.03298 | 0.103 | fixed |
| sibling_count4 | 0.005935 | 0.03659 | 0.1622 | -0.06578 | 0.07765 | fixed |
| sibling_count5 | 0.001283 | 0.03871 | 0.03314 | -0.07459 | 0.07716 | fixed |
| sibling_count5+ | -0.1803 | 0.03284 | -5.489 | -0.2446 | -0.1159 | fixed |
| birth_order_nonlinear2 | -0.01433 | 0.02147 | -0.6675 | -0.05641 | 0.02775 | fixed |
| birth_order_nonlinear3 | -0.0118 | 0.02501 | -0.4716 | -0.06082 | 0.03723 | fixed |
| birth_order_nonlinear4 | -0.03464 | 0.0284 | -1.22 | -0.0903 | 0.02102 | fixed |
| birth_order_nonlinear5 | 0.01513 | 0.03228 | 0.4688 | -0.04814 | 0.07841 | fixed |
| birth_order_nonlinear5+ | -0.02847 | 0.02793 | -1.019 | -0.08321 | 0.02627 | fixed |
| sd_(Intercept).mother_pidlink | 0.5822 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.744 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1955 | 0.203 | 0.9634 | -0.2023 | 0.5933 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02567 | 0.02079 | 1.235 | -0.01507 | 0.06642 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00106 | 0.0006683 | -1.586 | -0.00237 | 0.00025 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000004077 | 0.000006744 | 0.6046 | -0.00000914 | 0.0000173 | fixed |
| male | 0.06191 | 0.01493 | 4.145 | 0.03264 | 0.09118 | fixed |
| count_birth_order2/2 | -0.04118 | 0.04236 | -0.9722 | -0.1242 | 0.04184 | fixed |
| count_birth_order1/3 | 0.02571 | 0.04281 | 0.6006 | -0.0582 | 0.1096 | fixed |
| count_birth_order2/3 | 0.01942 | 0.04732 | 0.4103 | -0.07334 | 0.1122 | fixed |
| count_birth_order3/3 | 0.0007667 | 0.05251 | 0.0146 | -0.1021 | 0.1037 | fixed |
| count_birth_order1/4 | -0.01819 | 0.04862 | -0.374 | -0.1135 | 0.07711 | fixed |
| count_birth_order2/4 | 0.01964 | 0.05083 | 0.3863 | -0.08 | 0.1193 | fixed |
| count_birth_order3/4 | -0.02461 | 0.05444 | -0.4519 | -0.1313 | 0.0821 | fixed |
| count_birth_order4/4 | -0.059 | 0.05719 | -1.032 | -0.1711 | 0.05308 | fixed |
| count_birth_order1/5 | -0.09978 | 0.05416 | -1.842 | -0.2059 | 0.006367 | fixed |
| count_birth_order2/5 | -0.00005492 | 0.05667 | -0.000969 | -0.1111 | 0.111 | fixed |
| count_birth_order3/5 | 0.003105 | 0.05811 | 0.05344 | -0.1108 | 0.117 | fixed |
| count_birth_order4/5 | -0.01033 | 0.06116 | -0.1689 | -0.1302 | 0.1095 | fixed |
| count_birth_order5/5 | 0.0591 | 0.06229 | 0.9489 | -0.06298 | 0.1812 | fixed |
| count_birth_order1/5+ | -0.1474 | 0.04374 | -3.371 | -0.2332 | -0.06171 | fixed |
| count_birth_order2/5+ | -0.2332 | 0.04485 | -5.198 | -0.3211 | -0.1452 | fixed |
| count_birth_order3/5+ | -0.1994 | 0.04399 | -4.531 | -0.2856 | -0.1131 | fixed |
| count_birth_order4/5+ | -0.2272 | 0.04306 | -5.276 | -0.3116 | -0.1428 | fixed |
| count_birth_order5/5+ | -0.1914 | 0.04332 | -4.419 | -0.2764 | -0.1065 | fixed |
| count_birth_order5+/5+ | -0.2187 | 0.03572 | -6.122 | -0.2887 | -0.1487 | fixed |
| sd_(Intercept).mother_pidlink | 0.5821 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7439 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 35518 | 35600 | -17748 | 35496 | NA | NA | NA |
| 12 | 35519 | 35609 | -17747 | 35495 | 0.8602 | 1 | 0.3537 |
| 16 | 35524 | 35644 | -17746 | 35492 | 2.576 | 4 | 0.631 |
| 26 | 35532 | 35728 | -17740 | 35480 | 11.82 | 10 | 0.2971 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8339 | 0.3708 | -2.249 | -1.561 | -0.1072 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1467 | 0.04203 | 3.489 | 0.06427 | 0.229 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.004903 | 0.001499 | -3.271 | -0.007841 | -0.001965 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004724 | 0.00001697 | 2.784 | 0.00001399 | 0.0000805 | fixed |
| male | -0.02065 | 0.02158 | -0.9572 | -0.06294 | 0.02164 | fixed |
| sibling_count3 | 0.0003067 | 0.03701 | 0.008289 | -0.07222 | 0.07284 | fixed |
| sibling_count4 | -0.0771 | 0.04036 | -1.91 | -0.1562 | 0.002002 | fixed |
| sibling_count5 | -0.1511 | 0.04636 | -3.26 | -0.242 | -0.06025 | fixed |
| sibling_count5+ | -0.2821 | 0.04094 | -6.891 | -0.3624 | -0.2019 | fixed |
| sd_(Intercept).mother_pidlink | 0.5177 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.6977 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8412 | 0.3708 | -2.269 | -1.568 | -0.1145 | fixed |
| birth_order | 0.009041 | 0.007302 | 1.238 | -0.005271 | 0.02335 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.146 | 0.04203 | 3.473 | 0.0636 | 0.2284 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.004888 | 0.001499 | -3.261 | -0.007826 | -0.00195 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004746 | 0.00001697 | 2.797 | 0.0000142 | 0.00008071 | fixed |
| male | -0.02114 | 0.02158 | -0.9795 | -0.06343 | 0.02116 | fixed |
| sibling_count3 | -0.004319 | 0.0372 | -0.1161 | -0.07722 | 0.06858 | fixed |
| sibling_count4 | -0.08824 | 0.04135 | -2.134 | -0.1693 | -0.007188 | fixed |
| sibling_count5 | -0.169 | 0.04857 | -3.48 | -0.2642 | -0.07383 | fixed |
| sibling_count5+ | -0.3178 | 0.05005 | -6.349 | -0.4159 | -0.2197 | fixed |
| sd_(Intercept).mother_pidlink | 0.518 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.6974 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8705 | 0.3718 | -2.341 | -1.599 | -0.1418 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1492 | 0.04209 | 3.546 | 0.06675 | 0.2317 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005006 | 0.001501 | -3.336 | -0.007947 | -0.002064 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004879 | 0.00001699 | 2.872 | 0.0000155 | 0.00008209 | fixed |
| male | -0.02051 | 0.02158 | -0.9504 | -0.06281 | 0.02179 | fixed |
| sibling_count3 | -0.006197 | 0.0378 | -0.164 | -0.08028 | 0.06788 | fixed |
| sibling_count4 | -0.08533 | 0.04264 | -2.001 | -0.1689 | -0.001759 | fixed |
| sibling_count5 | -0.175 | 0.05049 | -3.466 | -0.2739 | -0.07602 | fixed |
| sibling_count5+ | -0.3206 | 0.05119 | -6.263 | -0.421 | -0.2203 | fixed |
| birth_order_nonlinear2 | 0.03959 | 0.02714 | 1.459 | -0.01361 | 0.09279 | fixed |
| birth_order_nonlinear3 | 0.02682 | 0.03361 | 0.7981 | -0.03905 | 0.09269 | fixed |
| birth_order_nonlinear4 | 0.0122 | 0.04178 | 0.292 | -0.06969 | 0.09409 | fixed |
| birth_order_nonlinear5 | 0.09656 | 0.05185 | 1.862 | -0.005073 | 0.1982 | fixed |
| birth_order_nonlinear5+ | 0.06261 | 0.05372 | 1.166 | -0.04268 | 0.1679 | fixed |
| sd_(Intercept).mother_pidlink | 0.5179 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.6975 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8752 | 0.3728 | -2.348 | -1.606 | -0.1446 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1489 | 0.04219 | 3.53 | 0.06625 | 0.2316 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.004981 | 0.001505 | -3.311 | -0.00793 | -0.002032 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004837 | 0.00001704 | 2.839 | 0.00001498 | 0.00008176 | fixed |
| male | -0.02137 | 0.0216 | -0.9894 | -0.06371 | 0.02097 | fixed |
| count_birth_order2/2 | 0.05487 | 0.04968 | 1.105 | -0.0425 | 0.1522 | fixed |
| count_birth_order1/3 | -0.006477 | 0.04639 | -0.1396 | -0.0974 | 0.08444 | fixed |
| count_birth_order2/3 | 0.04298 | 0.05006 | 0.8586 | -0.05513 | 0.1411 | fixed |
| count_birth_order3/3 | 0.02919 | 0.0557 | 0.5241 | -0.07999 | 0.1384 | fixed |
| count_birth_order1/4 | -0.1094 | 0.05641 | -1.939 | -0.22 | 0.001176 | fixed |
| count_birth_order2/4 | -0.02503 | 0.05803 | -0.4314 | -0.1388 | 0.08871 | fixed |
| count_birth_order3/4 | -0.06345 | 0.06065 | -1.046 | -0.1823 | 0.05541 | fixed |
| count_birth_order4/4 | -0.03422 | 0.06329 | -0.5408 | -0.1583 | 0.08982 | fixed |
| count_birth_order1/5 | -0.1232 | 0.07517 | -1.639 | -0.2706 | 0.02409 | fixed |
| count_birth_order2/5 | -0.0938 | 0.08081 | -1.161 | -0.2522 | 0.06458 | fixed |
| count_birth_order3/5 | -0.1584 | 0.07568 | -2.093 | -0.3067 | -0.01005 | fixed |
| count_birth_order4/5 | -0.1877 | 0.07323 | -2.563 | -0.3312 | -0.04416 | fixed |
| count_birth_order5/5 | -0.1089 | 0.07511 | -1.45 | -0.2561 | 0.03829 | fixed |
| count_birth_order1/5+ | -0.2572 | 0.07465 | -3.446 | -0.4035 | -0.1109 | fixed |
| count_birth_order2/5+ | -0.373 | 0.07449 | -5.008 | -0.519 | -0.227 | fixed |
| count_birth_order3/5+ | -0.2644 | 0.07378 | -3.583 | -0.409 | -0.1198 | fixed |
| count_birth_order4/5+ | -0.3211 | 0.06919 | -4.641 | -0.4567 | -0.1855 | fixed |
| count_birth_order5/5+ | -0.1957 | 0.06586 | -2.972 | -0.3248 | -0.06663 | fixed |
| count_birth_order5+/5+ | -0.2531 | 0.05163 | -4.903 | -0.3543 | -0.152 | fixed |
| sd_(Intercept).mother_pidlink | 0.5182 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.6977 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 14535 | 14608 | -7257 | 14513 | NA | NA | NA |
| 12 | 14536 | 14616 | -7256 | 14512 | 1.533 | 1 | 0.2156 |
| 16 | 14540 | 14647 | -7254 | 14508 | 3.603 | 4 | 0.4623 |
| 26 | 14553 | 14727 | -7251 | 14501 | 6.45 | 10 | 0.7761 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8021 | 0.3701 | -2.168 | -1.527 | -0.07681 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1431 | 0.04197 | 3.41 | 0.06086 | 0.2254 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.004819 | 0.001497 | -3.219 | -0.007753 | -0.001885 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004624 | 0.00001695 | 2.728 | 0.00001302 | 0.00007946 | fixed |
| male | -0.02123 | 0.02151 | -0.9869 | -0.0634 | 0.02093 | fixed |
| sibling_count3 | 0.006856 | 0.03997 | 0.1715 | -0.07149 | 0.0852 | fixed |
| sibling_count4 | -0.0426 | 0.0426 | -1 | -0.1261 | 0.04089 | fixed |
| sibling_count5 | -0.07804 | 0.04578 | -1.705 | -0.1678 | 0.01168 | fixed |
| sibling_count5+ | -0.1916 | 0.04007 | -4.783 | -0.2702 | -0.1131 | fixed |
| sd_(Intercept).mother_pidlink | 0.5208 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.6974 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.7996 | 0.3702 | -2.16 | -1.525 | -0.07407 | fixed |
| birth_order | -0.002276 | 0.006431 | -0.354 | -0.01488 | 0.01033 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1432 | 0.04197 | 3.412 | 0.06094 | 0.2255 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00482 | 0.001497 | -3.219 | -0.007754 | -0.001885 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004615 | 0.00001695 | 2.722 | 0.00001293 | 0.00007938 | fixed |
| male | -0.02113 | 0.02152 | -0.9817 | -0.0633 | 0.02105 | fixed |
| sibling_count3 | 0.008026 | 0.04011 | 0.2001 | -0.07059 | 0.08664 | fixed |
| sibling_count4 | -0.03991 | 0.04327 | -0.9224 | -0.1247 | 0.0449 | fixed |
| sibling_count5 | -0.07387 | 0.04727 | -1.563 | -0.1665 | 0.01878 | fixed |
| sibling_count5+ | -0.183 | 0.04692 | -3.9 | -0.275 | -0.09105 | fixed |
| sd_(Intercept).mother_pidlink | 0.5206 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.6975 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8363 | 0.371 | -2.254 | -1.564 | -0.1091 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1458 | 0.04202 | 3.469 | 0.06341 | 0.2281 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.004913 | 0.001499 | -3.278 | -0.00785 | -0.001975 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004722 | 0.00001697 | 2.782 | 0.00001395 | 0.00008048 | fixed |
| male | -0.02023 | 0.02152 | -0.9401 | -0.06242 | 0.02195 | fixed |
| sibling_count3 | 0.008151 | 0.04069 | 0.2003 | -0.07159 | 0.0879 | fixed |
| sibling_count4 | -0.03462 | 0.04449 | -0.7782 | -0.1218 | 0.05258 | fixed |
| sibling_count5 | -0.0762 | 0.04905 | -1.554 | -0.1723 | 0.01993 | fixed |
| sibling_count5+ | -0.1822 | 0.04805 | -3.792 | -0.2764 | -0.08804 | fixed |
| birth_order_nonlinear2 | 0.0345 | 0.02777 | 1.242 | -0.01993 | 0.08893 | fixed |
| birth_order_nonlinear3 | -0.005354 | 0.03358 | -0.1595 | -0.07117 | 0.06046 | fixed |
| birth_order_nonlinear4 | -0.02399 | 0.0407 | -0.5894 | -0.1038 | 0.05579 | fixed |
| birth_order_nonlinear5 | 0.04948 | 0.0496 | 0.9975 | -0.04774 | 0.1467 | fixed |
| birth_order_nonlinear5+ | -0.009693 | 0.04843 | -0.2002 | -0.1046 | 0.08522 | fixed |
| sd_(Intercept).mother_pidlink | 0.5206 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.6975 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8476 | 0.3718 | -2.28 | -1.576 | -0.1188 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1447 | 0.04207 | 3.438 | 0.0622 | 0.2271 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.004861 | 0.001501 | -3.238 | -0.007803 | -0.001919 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004649 | 0.000017 | 2.734 | 0.00001317 | 0.00007981 | fixed |
| male | -0.02115 | 0.02153 | -0.9822 | -0.06334 | 0.02105 | fixed |
| count_birth_order2/2 | 0.09269 | 0.05458 | 1.698 | -0.01428 | 0.1997 | fixed |
| count_birth_order1/3 | 0.03991 | 0.05027 | 0.7939 | -0.05862 | 0.1384 | fixed |
| count_birth_order2/3 | 0.02977 | 0.05389 | 0.5524 | -0.07585 | 0.1354 | fixed |
| count_birth_order3/3 | 0.04257 | 0.06031 | 0.7058 | -0.07564 | 0.1608 | fixed |
| count_birth_order1/4 | -0.07608 | 0.05917 | -1.286 | -0.1921 | 0.03989 | fixed |
| count_birth_order2/4 | 0.08764 | 0.06018 | 1.456 | -0.03032 | 0.2056 | fixed |
| count_birth_order3/4 | -0.0303 | 0.065 | -0.4661 | -0.1577 | 0.0971 | fixed |
| count_birth_order4/4 | -0.03003 | 0.06725 | -0.4466 | -0.1618 | 0.1018 | fixed |
| count_birth_order1/5 | -0.0001437 | 0.06919 | -0.002077 | -0.1357 | 0.1355 | fixed |
| count_birth_order2/5 | -0.01429 | 0.07426 | -0.1925 | -0.1598 | 0.1313 | fixed |
| count_birth_order3/5 | -0.1014 | 0.07188 | -1.411 | -0.2423 | 0.03948 | fixed |
| count_birth_order4/5 | -0.1037 | 0.07452 | -1.391 | -0.2497 | 0.04236 | fixed |
| count_birth_order5/5 | -0.02898 | 0.07439 | -0.3896 | -0.1748 | 0.1168 | fixed |
| count_birth_order1/5+ | -0.1089 | 0.06599 | -1.65 | -0.2382 | 0.02047 | fixed |
| count_birth_order2/5+ | -0.2303 | 0.06883 | -3.346 | -0.3652 | -0.09542 | fixed |
| count_birth_order3/5+ | -0.1537 | 0.06699 | -2.294 | -0.285 | -0.02239 | fixed |
| count_birth_order4/5+ | -0.1817 | 0.06466 | -2.81 | -0.3084 | -0.05497 | fixed |
| count_birth_order5/5+ | -0.1002 | 0.06589 | -1.52 | -0.2293 | 0.02896 | fixed |
| count_birth_order5+/5+ | -0.1736 | 0.05057 | -3.433 | -0.2727 | -0.07449 | fixed |
| sd_(Intercept).mother_pidlink | 0.5209 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.6971 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 14682 | 14755 | -7330 | 14660 | NA | NA | NA |
| 12 | 14684 | 14764 | -7330 | 14660 | 0.1261 | 1 | 0.7225 |
| 16 | 14687 | 14794 | -7328 | 14655 | 4.215 | 4 | 0.3777 |
| 26 | 14694 | 14868 | -7321 | 14642 | 13.01 | 10 | 0.2232 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.9226 | 0.3751 | -2.46 | -1.658 | -0.1875 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1559 | 0.04254 | 3.665 | 0.07254 | 0.2393 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005258 | 0.001517 | -3.465 | -0.008231 | -0.002284 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000515 | 0.00001718 | 2.997 | 0.00001782 | 0.00008518 | fixed |
| male | -0.02117 | 0.0218 | -0.9713 | -0.06389 | 0.02155 | fixed |
| sibling_count3 | 0.01472 | 0.03647 | 0.4035 | -0.05677 | 0.0862 | fixed |
| sibling_count4 | -0.06404 | 0.04 | -1.601 | -0.1424 | 0.01437 | fixed |
| sibling_count5 | -0.1279 | 0.04754 | -2.691 | -0.2211 | -0.03476 | fixed |
| sibling_count5+ | -0.271 | 0.04142 | -6.541 | -0.3522 | -0.1898 | fixed |
| sd_(Intercept).mother_pidlink | 0.5155 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.6986 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.9298 | 0.3751 | -2.479 | -1.665 | -0.1947 | fixed |
| birth_order | 0.01005 | 0.007512 | 1.338 | -0.004672 | 0.02477 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1551 | 0.04254 | 3.646 | 0.07172 | 0.2385 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005241 | 0.001517 | -3.454 | -0.008214 | -0.002267 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005174 | 0.00001718 | 3.011 | 0.00001806 | 0.00008542 | fixed |
| male | -0.0215 | 0.0218 | -0.9866 | -0.06422 | 0.02122 | fixed |
| sibling_count3 | 0.009523 | 0.03668 | 0.2596 | -0.06237 | 0.08141 | fixed |
| sibling_count4 | -0.07619 | 0.04102 | -1.857 | -0.1566 | 0.004212 | fixed |
| sibling_count5 | -0.147 | 0.04963 | -2.962 | -0.2443 | -0.04973 | fixed |
| sibling_count5+ | -0.3101 | 0.0507 | -6.116 | -0.4095 | -0.2107 | fixed |
| sd_(Intercept).mother_pidlink | 0.5157 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.6984 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.9568 | 0.3761 | -2.544 | -1.694 | -0.2197 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1581 | 0.0426 | 3.711 | 0.07459 | 0.2416 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005346 | 0.001519 | -3.519 | -0.008323 | -0.002369 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000529 | 0.0000172 | 3.075 | 0.00001918 | 0.00008662 | fixed |
| male | -0.0212 | 0.0218 | -0.9723 | -0.06393 | 0.02153 | fixed |
| sibling_count3 | 0.00883 | 0.03729 | 0.2368 | -0.06427 | 0.08192 | fixed |
| sibling_count4 | -0.07612 | 0.04236 | -1.797 | -0.1591 | 0.006895 | fixed |
| sibling_count5 | -0.1499 | 0.05142 | -2.914 | -0.2506 | -0.04907 | fixed |
| sibling_count5+ | -0.3102 | 0.05189 | -5.978 | -0.4119 | -0.2085 | fixed |
| birth_order_nonlinear2 | 0.04352 | 0.02709 | 1.606 | -0.00958 | 0.09662 | fixed |
| birth_order_nonlinear3 | 0.02617 | 0.03362 | 0.7785 | -0.03972 | 0.09207 | fixed |
| birth_order_nonlinear4 | 0.0344 | 0.04292 | 0.8015 | -0.04972 | 0.1185 | fixed |
| birth_order_nonlinear5 | 0.07337 | 0.05415 | 1.355 | -0.03276 | 0.1795 | fixed |
| birth_order_nonlinear5+ | 0.06926 | 0.0553 | 1.252 | -0.03912 | 0.1776 | fixed |
| sd_(Intercept).mother_pidlink | 0.5155 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.6987 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.9636 | 0.3773 | -2.554 | -1.703 | -0.2242 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1579 | 0.04271 | 3.697 | 0.07418 | 0.2416 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005325 | 0.001524 | -3.495 | -0.008311 | -0.002339 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000525 | 0.00001726 | 3.042 | 0.00001867 | 0.00008633 | fixed |
| male | -0.02235 | 0.02182 | -1.024 | -0.06513 | 0.02042 | fixed |
| count_birth_order2/2 | 0.06086 | 0.04827 | 1.261 | -0.03375 | 0.1555 | fixed |
| count_birth_order1/3 | 0.007247 | 0.04578 | 0.1583 | -0.08247 | 0.09696 | fixed |
| count_birth_order2/3 | 0.0644 | 0.04994 | 1.29 | -0.03348 | 0.1623 | fixed |
| count_birth_order3/3 | 0.04643 | 0.05471 | 0.8486 | -0.0608 | 0.1537 | fixed |
| count_birth_order1/4 | -0.09561 | 0.05654 | -1.691 | -0.2064 | 0.0152 | fixed |
| count_birth_order2/4 | -0.0208 | 0.05792 | -0.3592 | -0.1343 | 0.09272 | fixed |
| count_birth_order3/4 | -0.04594 | 0.06005 | -0.765 | -0.1636 | 0.07176 | fixed |
| count_birth_order4/4 | -0.004906 | 0.06335 | -0.07745 | -0.1291 | 0.1192 | fixed |
| count_birth_order1/5 | -0.1047 | 0.07511 | -1.394 | -0.252 | 0.04248 | fixed |
| count_birth_order2/5 | -0.07203 | 0.08321 | -0.8656 | -0.2351 | 0.09106 | fixed |
| count_birth_order3/5 | -0.1374 | 0.0791 | -1.738 | -0.2925 | 0.01759 | fixed |
| count_birth_order4/5 | -0.1243 | 0.0766 | -1.623 | -0.2745 | 0.02578 | fixed |
| count_birth_order5/5 | -0.112 | 0.08027 | -1.395 | -0.2693 | 0.04534 | fixed |
| count_birth_order1/5+ | -0.2309 | 0.07637 | -3.024 | -0.3806 | -0.08123 | fixed |
| count_birth_order2/5+ | -0.3469 | 0.07643 | -4.539 | -0.4967 | -0.1971 | fixed |
| count_birth_order3/5+ | -0.2686 | 0.07462 | -3.599 | -0.4149 | -0.1223 | fixed |
| count_birth_order4/5+ | -0.3014 | 0.07262 | -4.15 | -0.4437 | -0.1591 | fixed |
| count_birth_order5/5+ | -0.2063 | 0.06741 | -3.061 | -0.3385 | -0.07422 | fixed |
| count_birth_order5+/5+ | -0.2356 | 0.05257 | -4.482 | -0.3386 | -0.1326 | fixed |
| sd_(Intercept).mother_pidlink | 0.5157 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.699 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 14247 | 14320 | -7112 | 14225 | NA | NA | NA |
| 12 | 14247 | 14327 | -7111 | 14223 | 1.792 | 1 | 0.1807 |
| 16 | 14253 | 14359 | -7110 | 14221 | 2.106 | 4 | 0.7163 |
| 26 | 14267 | 14440 | -7108 | 14215 | 5.623 | 10 | 0.8458 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = g_factor_2015_young)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count +
(1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.216 | 0.1156 | -27.82 | -3.443 | -2.99 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4938 | 0.02146 | 23.01 | 0.4517 | 0.5358 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02095 | 0.001245 | -16.83 | -0.02339 | -0.01851 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002754 | 0.00002287 | 12.04 | 0.0002305 | 0.0003202 | fixed |
| male | -0.06654 | 0.01647 | -4.04 | -0.09882 | -0.03426 | fixed |
| sibling_count3 | -0.02258 | 0.02855 | -0.791 | -0.07853 | 0.03337 | fixed |
| sibling_count4 | -0.1055 | 0.03201 | -3.295 | -0.1682 | -0.04272 | fixed |
| sibling_count5 | -0.07458 | 0.03622 | -2.059 | -0.1456 | -0.003602 | fixed |
| sibling_count5+ | -0.2683 | 0.02871 | -9.345 | -0.3245 | -0.212 | fixed |
| sd_(Intercept).mother_pidlink | 0.5086 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7822 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.201 | 0.116 | -27.6 | -3.428 | -2.974 | fixed |
| birth_order | -0.006933 | 0.004416 | -1.57 | -0.01559 | 0.001723 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4933 | 0.02146 | 22.98 | 0.4512 | 0.5353 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02094 | 0.001245 | -16.82 | -0.02338 | -0.0185 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002751 | 0.00002287 | 12.03 | 0.0002303 | 0.0003199 | fixed |
| male | -0.06643 | 0.01647 | -4.033 | -0.09871 | -0.03415 | fixed |
| sibling_count3 | -0.01848 | 0.02866 | -0.6447 | -0.07465 | 0.0377 | fixed |
| sibling_count4 | -0.0956 | 0.03262 | -2.931 | -0.1595 | -0.03167 | fixed |
| sibling_count5 | -0.05868 | 0.0376 | -1.561 | -0.1324 | 0.01502 | fixed |
| sibling_count5+ | -0.2291 | 0.03801 | -6.028 | -0.3036 | -0.1546 | fixed |
| sd_(Intercept).mother_pidlink | 0.5082 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7824 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.222 | 0.1171 | -27.51 | -3.452 | -2.993 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4949 | 0.02154 | 22.98 | 0.4527 | 0.5371 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02102 | 0.001247 | -16.86 | -0.02346 | -0.01857 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002761 | 0.00002288 | 12.07 | 0.0002313 | 0.000321 | fixed |
| male | -0.06671 | 0.01647 | -4.051 | -0.09899 | -0.03443 | fixed |
| sibling_count3 | -0.03268 | 0.02952 | -1.107 | -0.09054 | 0.02518 | fixed |
| sibling_count4 | -0.1082 | 0.03513 | -3.081 | -0.1771 | -0.03938 | fixed |
| sibling_count5 | -0.0603 | 0.04138 | -1.457 | -0.1414 | 0.02081 | fixed |
| sibling_count5+ | -0.2275 | 0.04184 | -5.437 | -0.3095 | -0.1455 | fixed |
| birth_order_nonlinear2 | 0.006876 | 0.02242 | 0.3068 | -0.03706 | 0.05081 | fixed |
| birth_order_nonlinear3 | 0.0427 | 0.02829 | 1.509 | -0.01275 | 0.09815 | fixed |
| birth_order_nonlinear4 | -0.03406 | 0.03506 | -0.9713 | -0.1028 | 0.03467 | fixed |
| birth_order_nonlinear5 | -0.04478 | 0.04123 | -1.086 | -0.1256 | 0.03602 | fixed |
| birth_order_nonlinear5+ | -0.05059 | 0.03926 | -1.289 | -0.1275 | 0.02635 | fixed |
| sd_(Intercept).mother_pidlink | 0.509 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7819 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.234 | 0.1181 | -27.37 | -3.465 | -3.002 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4962 | 0.02158 | 22.99 | 0.4539 | 0.5385 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0211 | 0.001249 | -16.9 | -0.02354 | -0.01865 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002775 | 0.00002291 | 12.11 | 0.0002326 | 0.0003224 | fixed |
| male | -0.06686 | 0.01647 | -4.058 | -0.09915 | -0.03457 | fixed |
| count_birth_order2/2 | 0.02197 | 0.03654 | 0.6012 | -0.04965 | 0.09358 | fixed |
| count_birth_order1/3 | -0.03817 | 0.03737 | -1.021 | -0.1114 | 0.03507 | fixed |
| count_birth_order2/3 | -0.01761 | 0.0381 | -0.4622 | -0.09229 | 0.05707 | fixed |
| count_birth_order3/3 | 0.02761 | 0.04314 | 0.64 | -0.05694 | 0.1122 | fixed |
| count_birth_order1/4 | -0.103 | 0.05108 | -2.017 | -0.2031 | -0.002897 | fixed |
| count_birth_order2/4 | -0.07822 | 0.04853 | -1.612 | -0.1733 | 0.01689 | fixed |
| count_birth_order3/4 | -0.1103 | 0.04572 | -2.412 | -0.1999 | -0.02068 | fixed |
| count_birth_order4/4 | -0.0947 | 0.0499 | -1.898 | -0.1925 | 0.003108 | fixed |
| count_birth_order1/5 | -0.01787 | 0.0693 | -0.2578 | -0.1537 | 0.118 | fixed |
| count_birth_order2/5 | -0.0782 | 0.06596 | -1.186 | -0.2075 | 0.05109 | fixed |
| count_birth_order3/5 | 0.01626 | 0.05977 | 0.272 | -0.1009 | 0.1334 | fixed |
| count_birth_order4/5 | -0.1432 | 0.05618 | -2.549 | -0.2533 | -0.0331 | fixed |
| count_birth_order5/5 | -0.07428 | 0.05573 | -1.333 | -0.1835 | 0.03494 | fixed |
| count_birth_order1/5+ | -0.1652 | 0.06939 | -2.38 | -0.3012 | -0.02916 | fixed |
| count_birth_order2/5+ | -0.2743 | 0.06498 | -4.221 | -0.4017 | -0.1469 | fixed |
| count_birth_order3/5+ | -0.1406 | 0.05784 | -2.431 | -0.254 | -0.02727 | fixed |
| count_birth_order4/5+ | -0.2586 | 0.05264 | -4.912 | -0.3618 | -0.1554 | fixed |
| count_birth_order5/5+ | -0.2829 | 0.04729 | -5.982 | -0.3756 | -0.1902 | fixed |
| count_birth_order5+/5+ | -0.2731 | 0.03302 | -8.271 | -0.3379 | -0.2084 | fixed |
| sd_(Intercept).mother_pidlink | 0.5085 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7822 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 31446 | 31527 | -15712 | 31424 | NA | NA | NA |
| 12 | 31446 | 31534 | -15711 | 31422 | 2.467 | 1 | 0.1162 |
| 16 | 31448 | 31566 | -15708 | 31416 | 6.164 | 4 | 0.1872 |
| 26 | 31459 | 31651 | -15703 | 31407 | 8.923 | 10 | 0.5394 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.724 | 0.1782 | -20.9 | -4.074 | -3.375 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5997 | 0.03658 | 16.4 | 0.528 | 0.6714 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02751 | 0.002318 | -11.87 | -0.03205 | -0.02297 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004057 | 0.00004565 | 8.887 | 0.0003162 | 0.0004952 | fixed |
| male | -0.08654 | 0.01931 | -4.481 | -0.1244 | -0.04869 | fixed |
| sibling_count3 | -0.03864 | 0.02747 | -1.407 | -0.09248 | 0.0152 | fixed |
| sibling_count4 | -0.1044 | 0.03372 | -3.095 | -0.1705 | -0.03828 | fixed |
| sibling_count5 | -0.2253 | 0.04329 | -5.203 | -0.3101 | -0.1404 | fixed |
| sibling_count5+ | -0.2776 | 0.04026 | -6.896 | -0.3565 | -0.1987 | fixed |
| sd_(Intercept).mother_pidlink | 0.5011 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.772 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.711 | 0.1805 | -20.55 | -4.064 | -3.357 | fixed |
| birth_order | -0.004161 | 0.008678 | -0.4795 | -0.02117 | 0.01285 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5985 | 0.03668 | 16.32 | 0.5266 | 0.6704 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02745 | 0.002322 | -11.82 | -0.032 | -0.0229 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004046 | 0.00004572 | 8.85 | 0.000315 | 0.0004942 | fixed |
| male | -0.08651 | 0.01931 | -4.479 | -0.1244 | -0.04865 | fixed |
| sibling_count3 | -0.03584 | 0.02808 | -1.276 | -0.09088 | 0.01921 | fixed |
| sibling_count4 | -0.09815 | 0.03614 | -2.716 | -0.169 | -0.02731 | fixed |
| sibling_count5 | -0.2149 | 0.04835 | -4.445 | -0.3097 | -0.1202 | fixed |
| sibling_count5+ | -0.2575 | 0.05816 | -4.427 | -0.3715 | -0.1435 | fixed |
| sd_(Intercept).mother_pidlink | 0.5009 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7721 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.74 | 0.1801 | -20.77 | -4.093 | -3.387 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.6015 | 0.03669 | 16.39 | 0.5296 | 0.6734 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02762 | 0.002322 | -11.9 | -0.03217 | -0.02307 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004079 | 0.00004571 | 8.922 | 0.0003183 | 0.0004975 | fixed |
| male | -0.08719 | 0.01931 | -4.514 | -0.125 | -0.04934 | fixed |
| sibling_count3 | -0.04374 | 0.0293 | -1.493 | -0.1012 | 0.01368 | fixed |
| sibling_count4 | -0.1057 | 0.03893 | -2.716 | -0.182 | -0.02943 | fixed |
| sibling_count5 | -0.1916 | 0.05298 | -3.616 | -0.2954 | -0.08775 | fixed |
| sibling_count5+ | -0.2788 | 0.06273 | -4.444 | -0.4017 | -0.1559 | fixed |
| birth_order_nonlinear2 | 0.02003 | 0.0231 | 0.867 | -0.02525 | 0.06531 | fixed |
| birth_order_nonlinear3 | 0.01649 | 0.03236 | 0.5095 | -0.04694 | 0.07993 | fixed |
| birth_order_nonlinear4 | -0.003464 | 0.04434 | -0.07813 | -0.09037 | 0.08344 | fixed |
| birth_order_nonlinear5 | -0.09202 | 0.05964 | -1.543 | -0.2089 | 0.02488 | fixed |
| birth_order_nonlinear5+ | 0.03902 | 0.06915 | 0.5643 | -0.09651 | 0.1745 | fixed |
| sd_(Intercept).mother_pidlink | 0.5014 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7717 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.749 | 0.181 | -20.72 | -4.104 | -3.395 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.6024 | 0.03679 | 16.37 | 0.5303 | 0.6745 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02769 | 0.002328 | -11.89 | -0.03225 | -0.02313 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004095 | 0.00004585 | 8.932 | 0.0003196 | 0.0004994 | fixed |
| male | -0.08649 | 0.01933 | -4.474 | -0.1244 | -0.0486 | fixed |
| count_birth_order2/2 | 0.03737 | 0.03244 | 1.152 | -0.02622 | 0.101 | fixed |
| count_birth_order1/3 | -0.03075 | 0.03821 | -0.8046 | -0.1056 | 0.04415 | fixed |
| count_birth_order2/3 | -0.02697 | 0.03676 | -0.7337 | -0.09902 | 0.04507 | fixed |
| count_birth_order3/3 | -0.01657 | 0.04023 | -0.4119 | -0.09543 | 0.06229 | fixed |
| count_birth_order1/4 | -0.08078 | 0.06022 | -1.341 | -0.1988 | 0.03726 | fixed |
| count_birth_order2/4 | -0.09773 | 0.05287 | -1.849 | -0.2014 | 0.005892 | fixed |
| count_birth_order3/4 | -0.118 | 0.05048 | -2.337 | -0.2169 | -0.01903 | fixed |
| count_birth_order4/4 | -0.06776 | 0.05001 | -1.355 | -0.1658 | 0.03025 | fixed |
| count_birth_order1/5 | -0.1764 | 0.1048 | -1.683 | -0.3818 | 0.02899 | fixed |
| count_birth_order2/5 | -0.125 | 0.09341 | -1.338 | -0.3081 | 0.05812 | fixed |
| count_birth_order3/5 | -0.09885 | 0.07912 | -1.249 | -0.2539 | 0.05621 | fixed |
| count_birth_order4/5 | -0.2459 | 0.06553 | -3.753 | -0.3744 | -0.1175 | fixed |
| count_birth_order5/5 | -0.2798 | 0.0636 | -4.399 | -0.4044 | -0.1551 | fixed |
| count_birth_order1/5+ | -0.2669 | 0.1339 | -1.994 | -0.5293 | -0.004587 | fixed |
| count_birth_order2/5+ | -0.2542 | 0.1225 | -2.076 | -0.4943 | -0.01421 | fixed |
| count_birth_order3/5+ | -0.245 | 0.1013 | -2.418 | -0.4436 | -0.04641 | fixed |
| count_birth_order4/5+ | -0.2884 | 0.09095 | -3.171 | -0.4667 | -0.1101 | fixed |
| count_birth_order5/5+ | -0.3627 | 0.07314 | -4.959 | -0.5061 | -0.2194 | fixed |
| count_birth_order5+/5+ | -0.2334 | 0.04879 | -4.784 | -0.329 | -0.1378 | fixed |
| sd_(Intercept).mother_pidlink | 0.5007 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7724 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 22331 | 22408 | -11154 | 22309 | NA | NA | NA |
| 12 | 22332 | 22417 | -11154 | 22308 | 0.2307 | 1 | 0.631 |
| 16 | 22335 | 22447 | -11151 | 22303 | 5.751 | 4 | 0.2185 |
| 26 | 22350 | 22533 | -11149 | 22298 | 4.402 | 10 | 0.9274 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.721 | 0.1775 | -20.97 | -4.069 | -3.374 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5982 | 0.03643 | 16.42 | 0.5268 | 0.6696 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02748 | 0.00231 | -11.9 | -0.03201 | -0.02296 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000405 | 0.0000455 | 8.901 | 0.0003159 | 0.0004942 | fixed |
| male | -0.08998 | 0.01922 | -4.682 | -0.1276 | -0.05231 | fixed |
| sibling_count3 | -0.0135 | 0.0288 | -0.4689 | -0.06995 | 0.04294 | fixed |
| sibling_count4 | -0.07019 | 0.03389 | -2.071 | -0.1366 | -0.003757 | fixed |
| sibling_count5 | -0.08416 | 0.03975 | -2.118 | -0.1621 | -0.006265 | fixed |
| sibling_count5+ | -0.2069 | 0.03541 | -5.841 | -0.2763 | -0.1374 | fixed |
| sd_(Intercept).mother_pidlink | 0.5042 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7715 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.669 | 0.1792 | -20.47 | -4.02 | -3.318 | fixed |
| birth_order | -0.01542 | 0.007277 | -2.119 | -0.02968 | -0.001158 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5933 | 0.03651 | 16.25 | 0.5217 | 0.6648 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02725 | 0.002312 | -11.79 | -0.03179 | -0.02272 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000401 | 0.00004554 | 8.805 | 0.0003118 | 0.0004903 | fixed |
| male | -0.0895 | 0.01922 | -4.657 | -0.1272 | -0.05183 | fixed |
| sibling_count3 | -0.003641 | 0.02916 | -0.1249 | -0.06079 | 0.05351 | fixed |
| sibling_count4 | -0.04804 | 0.03545 | -1.355 | -0.1175 | 0.02143 | fixed |
| sibling_count5 | -0.04937 | 0.04297 | -1.149 | -0.1336 | 0.03486 | fixed |
| sibling_count5+ | -0.1363 | 0.0486 | -2.804 | -0.2316 | -0.04105 | fixed |
| sd_(Intercept).mother_pidlink | 0.5031 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7718 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.707 | 0.1791 | -20.7 | -4.058 | -3.356 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5959 | 0.03652 | 16.32 | 0.5243 | 0.6675 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02739 | 0.002312 | -11.85 | -0.03192 | -0.02286 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004033 | 0.00004554 | 8.857 | 0.000314 | 0.0004925 | fixed |
| male | -0.09039 | 0.01922 | -4.703 | -0.1281 | -0.05272 | fixed |
| sibling_count3 | -0.01831 | 0.03031 | -0.6043 | -0.07772 | 0.04109 | fixed |
| sibling_count4 | -0.06181 | 0.03823 | -1.617 | -0.1367 | 0.01312 | fixed |
| sibling_count5 | -0.03862 | 0.04684 | -0.8245 | -0.1304 | 0.05318 | fixed |
| sibling_count5+ | -0.1467 | 0.05156 | -2.846 | -0.2478 | -0.04566 | fixed |
| birth_order_nonlinear2 | 0.005876 | 0.02377 | 0.2472 | -0.04072 | 0.05247 | fixed |
| birth_order_nonlinear3 | 0.01979 | 0.03171 | 0.624 | -0.04237 | 0.08195 | fixed |
| birth_order_nonlinear4 | -0.04034 | 0.04163 | -0.969 | -0.1219 | 0.04125 | fixed |
| birth_order_nonlinear5 | -0.1249 | 0.05231 | -2.388 | -0.2275 | -0.02241 | fixed |
| birth_order_nonlinear5+ | -0.06325 | 0.05686 | -1.112 | -0.1747 | 0.04819 | fixed |
| sd_(Intercept).mother_pidlink | 0.5046 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7711 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.714 | 0.1801 | -20.62 | -4.067 | -3.361 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5966 | 0.03659 | 16.31 | 0.5249 | 0.6684 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02745 | 0.002316 | -11.85 | -0.03199 | -0.02291 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004048 | 0.00004562 | 8.874 | 0.0003154 | 0.0004942 | fixed |
| male | -0.08969 | 0.01923 | -4.664 | -0.1274 | -0.05199 | fixed |
| count_birth_order2/2 | 0.01737 | 0.03542 | 0.4903 | -0.05206 | 0.0868 | fixed |
| count_birth_order1/3 | -0.0044 | 0.03957 | -0.1112 | -0.08195 | 0.07316 | fixed |
| count_birth_order2/3 | -0.01004 | 0.0387 | -0.2595 | -0.08589 | 0.06581 | fixed |
| count_birth_order3/3 | -0.004255 | 0.04242 | -0.1003 | -0.08739 | 0.07888 | fixed |
| count_birth_order1/4 | -0.1121 | 0.05889 | -1.903 | -0.2275 | 0.003338 | fixed |
| count_birth_order2/4 | -0.06207 | 0.05288 | -1.174 | -0.1657 | 0.04158 | fixed |
| count_birth_order3/4 | -0.05365 | 0.05062 | -1.06 | -0.1529 | 0.04557 | fixed |
| count_birth_order4/4 | -0.03904 | 0.05121 | -0.7624 | -0.1394 | 0.06132 | fixed |
| count_birth_order1/5 | 0.06733 | 0.08556 | 0.787 | -0.1004 | 0.235 | fixed |
| count_birth_order2/5 | -0.03288 | 0.07661 | -0.4292 | -0.183 | 0.1173 | fixed |
| count_birth_order3/5 | 0.02536 | 0.06882 | 0.3685 | -0.1095 | 0.1602 | fixed |
| count_birth_order4/5 | -0.1427 | 0.0634 | -2.251 | -0.267 | -0.01844 | fixed |
| count_birth_order5/5 | -0.167 | 0.0611 | -2.733 | -0.2867 | -0.04723 | fixed |
| count_birth_order1/5+ | -0.1296 | 0.09156 | -1.416 | -0.3091 | 0.04982 | fixed |
| count_birth_order2/5+ | -0.154 | 0.1017 | -1.514 | -0.3532 | 0.04533 | fixed |
| count_birth_order3/5+ | -0.08844 | 0.07879 | -1.122 | -0.2429 | 0.06599 | fixed |
| count_birth_order4/5+ | -0.2195 | 0.07233 | -3.034 | -0.3612 | -0.07771 | fixed |
| count_birth_order5/5+ | -0.2618 | 0.063 | -4.156 | -0.3853 | -0.1383 | fixed |
| count_birth_order5+/5+ | -0.2058 | 0.04418 | -4.659 | -0.2924 | -0.1192 | fixed |
| sd_(Intercept).mother_pidlink | 0.5045 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7713 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 22622 | 22699 | -11300 | 22600 | NA | NA | NA |
| 12 | 22619 | 22704 | -11298 | 22595 | 4.494 | 1 | 0.03401 |
| 16 | 22623 | 22736 | -11296 | 22591 | 4.198 | 4 | 0.3799 |
| 26 | 22635 | 22819 | -11292 | 22583 | 7.659 | 10 | 0.6621 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.693 | 0.1793 | -20.6 | -4.044 | -3.341 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5935 | 0.03678 | 16.14 | 0.5214 | 0.6656 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02715 | 0.002329 | -11.65 | -0.03172 | -0.02258 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003988 | 0.00004585 | 8.698 | 0.0003089 | 0.0004887 | fixed |
| male | -0.08566 | 0.01947 | -4.399 | -0.1238 | -0.04749 | fixed |
| sibling_count3 | -0.03641 | 0.02752 | -1.323 | -0.09036 | 0.01753 | fixed |
| sibling_count4 | -0.09427 | 0.03407 | -2.767 | -0.1611 | -0.02749 | fixed |
| sibling_count5 | -0.2168 | 0.04512 | -4.805 | -0.3052 | -0.1284 | fixed |
| sibling_count5+ | -0.2744 | 0.04164 | -6.59 | -0.356 | -0.1928 | fixed |
| sd_(Intercept).mother_pidlink | 0.5036 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7663 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.688 | 0.1818 | -20.29 | -4.044 | -3.332 | fixed |
| birth_order | -0.001416 | 0.008884 | -0.1594 | -0.01883 | 0.016 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5931 | 0.0369 | 16.07 | 0.5208 | 0.6654 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02713 | 0.002334 | -11.62 | -0.0317 | -0.02255 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003984 | 0.00004593 | 8.674 | 0.0003084 | 0.0004884 | fixed |
| male | -0.08565 | 0.01948 | -4.398 | -0.1238 | -0.04747 | fixed |
| sibling_count3 | -0.03547 | 0.02816 | -1.26 | -0.09066 | 0.01972 | fixed |
| sibling_count4 | -0.09217 | 0.03655 | -2.522 | -0.1638 | -0.02053 | fixed |
| sibling_count5 | -0.2133 | 0.05003 | -4.264 | -0.3114 | -0.1153 | fixed |
| sibling_count5+ | -0.2677 | 0.05947 | -4.501 | -0.3842 | -0.1511 | fixed |
| sd_(Intercept).mother_pidlink | 0.5036 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7664 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.713 | 0.1813 | -20.49 | -4.068 | -3.358 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5961 | 0.03692 | 16.15 | 0.5237 | 0.6684 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0273 | 0.002334 | -11.69 | -0.03187 | -0.02272 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004017 | 0.00004594 | 8.745 | 0.0003117 | 0.0004918 | fixed |
| male | -0.0861 | 0.01948 | -4.42 | -0.1243 | -0.04792 | fixed |
| sibling_count3 | -0.03912 | 0.02934 | -1.333 | -0.09663 | 0.01839 | fixed |
| sibling_count4 | -0.1015 | 0.03929 | -2.584 | -0.1785 | -0.02451 | fixed |
| sibling_count5 | -0.1942 | 0.05459 | -3.558 | -0.3012 | -0.08722 | fixed |
| sibling_count5+ | -0.2932 | 0.0642 | -4.567 | -0.419 | -0.1674 | fixed |
| birth_order_nonlinear2 | 0.01886 | 0.02302 | 0.819 | -0.02627 | 0.06398 | fixed |
| birth_order_nonlinear3 | 0.0077 | 0.03246 | 0.2372 | -0.05593 | 0.07133 | fixed |
| birth_order_nonlinear4 | 0.02221 | 0.04513 | 0.4921 | -0.06624 | 0.1107 | fixed |
| birth_order_nonlinear5 | -0.07965 | 0.06213 | -1.282 | -0.2014 | 0.04212 | fixed |
| birth_order_nonlinear5+ | 0.0613 | 0.07122 | 0.8607 | -0.0783 | 0.2009 | fixed |
| sd_(Intercept).mother_pidlink | 0.5036 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7663 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.719 | 0.1822 | -20.41 | -4.076 | -3.361 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5962 | 0.03702 | 16.11 | 0.5237 | 0.6688 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02733 | 0.002341 | -11.67 | -0.03191 | -0.02274 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004025 | 0.00004607 | 8.737 | 0.0003122 | 0.0004928 | fixed |
| male | -0.0853 | 0.01949 | -4.376 | -0.1235 | -0.04709 | fixed |
| count_birth_order2/2 | 0.03444 | 0.03202 | 1.076 | -0.02832 | 0.0972 | fixed |
| count_birth_order1/3 | -0.02468 | 0.03831 | -0.6441 | -0.09977 | 0.05041 | fixed |
| count_birth_order2/3 | -0.02179 | 0.0368 | -0.5921 | -0.09391 | 0.05033 | fixed |
| count_birth_order3/3 | -0.02656 | 0.04033 | -0.6585 | -0.1056 | 0.05249 | fixed |
| count_birth_order1/4 | -0.08614 | 0.06046 | -1.425 | -0.2046 | 0.03235 | fixed |
| count_birth_order2/4 | -0.09269 | 0.05345 | -1.734 | -0.1974 | 0.01207 | fixed |
| count_birth_order3/4 | -0.1176 | 0.05075 | -2.318 | -0.2171 | -0.01819 | fixed |
| count_birth_order4/4 | -0.03975 | 0.0506 | -0.7855 | -0.1389 | 0.05943 | fixed |
| count_birth_order1/5 | -0.1523 | 0.1045 | -1.458 | -0.3571 | 0.05249 | fixed |
| count_birth_order2/5 | -0.1503 | 0.09998 | -1.503 | -0.3462 | 0.04566 | fixed |
| count_birth_order3/5 | -0.1079 | 0.08106 | -1.331 | -0.2668 | 0.05096 | fixed |
| count_birth_order4/5 | -0.2259 | 0.06879 | -3.285 | -0.3608 | -0.09113 | fixed |
| count_birth_order5/5 | -0.2732 | 0.06725 | -4.063 | -0.4051 | -0.1414 | fixed |
| count_birth_order1/5+ | -0.3269 | 0.1345 | -2.43 | -0.5906 | -0.06329 | fixed |
| count_birth_order2/5+ | -0.2724 | 0.1242 | -2.194 | -0.5157 | -0.02903 | fixed |
| count_birth_order3/5+ | -0.2516 | 0.1016 | -2.476 | -0.4508 | -0.05242 | fixed |
| count_birth_order4/5+ | -0.278 | 0.09641 | -2.883 | -0.467 | -0.08903 | fixed |
| count_birth_order5/5+ | -0.3623 | 0.07667 | -4.725 | -0.5126 | -0.212 | fixed |
| count_birth_order5+/5+ | -0.2261 | 0.05061 | -4.468 | -0.3253 | -0.1269 | fixed |
| sd_(Intercept).mother_pidlink | 0.5028 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.767 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 21671 | 21748 | -10824 | 21649 | NA | NA | NA |
| 12 | 21673 | 21757 | -10824 | 21649 | 0.02562 | 1 | 0.8728 |
| 16 | 21675 | 21787 | -10822 | 21643 | 5.499 | 4 | 0.2398 |
| 26 | 21691 | 21873 | -10820 | 21639 | 4.027 | 10 | 0.9461 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = g_factor_2007_old)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.967 | 1.932 | -3.605 | -10.75 | -3.179 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7971 | 0.2008 | 3.969 | 0.4035 | 1.191 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02803 | 0.006866 | -4.083 | -0.04149 | -0.01458 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003121 | 0.00007722 | 4.042 | 0.0001608 | 0.0004635 | fixed |
| male | 0.03153 | 0.02044 | 1.542 | -0.008534 | 0.07159 | fixed |
| sibling_count3 | 0.007267 | 0.05738 | 0.1266 | -0.1052 | 0.1197 | fixed |
| sibling_count4 | -0.1355 | 0.0562 | -2.412 | -0.2457 | -0.02541 | fixed |
| sibling_count5 | -0.04119 | 0.0572 | -0.7201 | -0.1533 | 0.07092 | fixed |
| sibling_count5+ | -0.2903 | 0.04694 | -6.184 | -0.3823 | -0.1983 | fixed |
| sd_(Intercept).mother_pidlink | 0.5938 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7824 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.953 | 1.933 | -3.597 | -10.74 | -3.164 | fixed |
| birth_order | -0.001446 | 0.004365 | -0.3312 | -0.01 | 0.00711 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7962 | 0.2009 | 3.964 | 0.4025 | 1.19 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02801 | 0.006867 | -4.078 | -0.04147 | -0.01455 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003118 | 0.00007724 | 4.037 | 0.0001604 | 0.0004632 | fixed |
| male | 0.03162 | 0.02044 | 1.547 | -0.008452 | 0.07169 | fixed |
| sibling_count3 | 0.007867 | 0.05741 | 0.137 | -0.1047 | 0.1204 | fixed |
| sibling_count4 | -0.1343 | 0.05633 | -2.384 | -0.2447 | -0.02388 | fixed |
| sibling_count5 | -0.03904 | 0.05757 | -0.6781 | -0.1519 | 0.0738 | fixed |
| sibling_count5+ | -0.2846 | 0.04998 | -5.695 | -0.3826 | -0.1867 | fixed |
| sd_(Intercept).mother_pidlink | 0.5937 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7825 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.89 | 1.934 | -3.562 | -10.68 | -3.099 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7923 | 0.201 | 3.942 | 0.3984 | 1.186 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02789 | 0.006872 | -4.059 | -0.04136 | -0.01442 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003108 | 0.00007729 | 4.021 | 0.0001593 | 0.0004623 | fixed |
| male | 0.03107 | 0.02045 | 1.52 | -0.009006 | 0.07115 | fixed |
| sibling_count3 | 0.01322 | 0.05816 | 0.2273 | -0.1008 | 0.1272 | fixed |
| sibling_count4 | -0.1258 | 0.05741 | -2.192 | -0.2384 | -0.01333 | fixed |
| sibling_count5 | -0.02862 | 0.05909 | -0.4843 | -0.1444 | 0.08719 | fixed |
| sibling_count5+ | -0.2855 | 0.05142 | -5.551 | -0.3862 | -0.1847 | fixed |
| birth_order_nonlinear2 | -0.062 | 0.03227 | -1.921 | -0.1252 | 0.001245 | fixed |
| birth_order_nonlinear3 | -0.05099 | 0.0347 | -1.469 | -0.119 | 0.01702 | fixed |
| birth_order_nonlinear4 | -0.04717 | 0.03805 | -1.24 | -0.1217 | 0.0274 | fixed |
| birth_order_nonlinear5 | -0.04488 | 0.04311 | -1.041 | -0.1294 | 0.03961 | fixed |
| birth_order_nonlinear5+ | -0.02096 | 0.03744 | -0.5599 | -0.09435 | 0.05242 | fixed |
| sd_(Intercept).mother_pidlink | 0.5941 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7822 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.963 | 1.936 | -3.596 | -10.76 | -3.168 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8025 | 0.2012 | 3.989 | 0.4082 | 1.197 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02824 | 0.006877 | -4.107 | -0.04172 | -0.01476 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003149 | 0.00007735 | 4.072 | 0.0001633 | 0.0004665 | fixed |
| male | 0.03059 | 0.02047 | 1.495 | -0.009522 | 0.0707 | fixed |
| count_birth_order2/2 | -0.1199 | 0.07505 | -1.598 | -0.267 | 0.02718 | fixed |
| count_birth_order1/3 | -0.01534 | 0.07666 | -0.2002 | -0.1656 | 0.1349 | fixed |
| count_birth_order2/3 | -0.01554 | 0.08162 | -0.1904 | -0.1755 | 0.1444 | fixed |
| count_birth_order3/3 | -0.1157 | 0.08194 | -1.412 | -0.2763 | 0.04492 | fixed |
| count_birth_order1/4 | -0.1356 | 0.07888 | -1.72 | -0.2902 | 0.01895 | fixed |
| count_birth_order2/4 | -0.1728 | 0.08201 | -2.107 | -0.3335 | -0.01202 | fixed |
| count_birth_order3/4 | -0.3025 | 0.08428 | -3.589 | -0.4677 | -0.1373 | fixed |
| count_birth_order4/4 | -0.1715 | 0.08514 | -2.015 | -0.3384 | -0.004665 | fixed |
| count_birth_order1/5 | -0.05674 | 0.08618 | -0.6584 | -0.2256 | 0.1122 | fixed |
| count_birth_order2/5 | -0.1972 | 0.08763 | -2.25 | -0.3689 | -0.0254 | fixed |
| count_birth_order3/5 | -0.05314 | 0.08644 | -0.6147 | -0.2226 | 0.1163 | fixed |
| count_birth_order4/5 | -0.1348 | 0.08841 | -1.525 | -0.3081 | 0.03846 | fixed |
| count_birth_order5/5 | -0.02949 | 0.09025 | -0.3268 | -0.2064 | 0.1474 | fixed |
| count_birth_order1/5+ | -0.3319 | 0.06889 | -4.818 | -0.4669 | -0.1969 | fixed |
| count_birth_order2/5+ | -0.3771 | 0.06928 | -5.443 | -0.5129 | -0.2413 | fixed |
| count_birth_order3/5+ | -0.3177 | 0.06806 | -4.669 | -0.4511 | -0.1843 | fixed |
| count_birth_order4/5+ | -0.359 | 0.06685 | -5.371 | -0.49 | -0.228 | fixed |
| count_birth_order5/5+ | -0.376 | 0.06763 | -5.559 | -0.5085 | -0.2434 | fixed |
| count_birth_order5+/5+ | -0.3317 | 0.05973 | -5.553 | -0.4487 | -0.2146 | fixed |
| sd_(Intercept).mother_pidlink | 0.5925 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7828 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 21826 | 21903 | -10902 | 21804 | NA | NA | NA |
| 12 | 21828 | 21912 | -10902 | 21804 | 0.1104 | 1 | 0.7396 |
| 16 | 21831 | 21943 | -10900 | 21799 | 4.713 | 4 | 0.3181 |
| 26 | 21840 | 22021 | -10894 | 21788 | 11.7 | 10 | 0.3055 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.205 | 3.657 | -1.697 | -13.37 | 0.9634 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7234 | 0.3805 | 1.901 | -0.02235 | 1.469 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02532 | 0.01301 | -1.947 | -0.05081 | 0.0001718 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002839 | 0.0001461 | 1.943 | -0.000002515 | 0.0005703 | fixed |
| male | -0.03673 | 0.02918 | -1.259 | -0.09393 | 0.02046 | fixed |
| sibling_count3 | 0.01766 | 0.05501 | 0.3211 | -0.09015 | 0.1255 | fixed |
| sibling_count4 | -0.08957 | 0.05691 | -1.574 | -0.2011 | 0.02198 | fixed |
| sibling_count5 | -0.1664 | 0.06228 | -2.671 | -0.2885 | -0.04431 | fixed |
| sibling_count5+ | -0.3372 | 0.0539 | -6.256 | -0.4429 | -0.2316 | fixed |
| sd_(Intercept).mother_pidlink | 0.539 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7449 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.448 | 3.656 | -1.764 | -13.61 | 0.7171 | fixed |
| birth_order | 0.023 | 0.009659 | 2.381 | 0.004065 | 0.04193 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7442 | 0.3803 | 1.957 | -0.001197 | 1.49 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02604 | 0.013 | -2.003 | -0.05152 | -0.0005649 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000293 | 0.000146 | 2.006 | 0.000006727 | 0.0005792 | fixed |
| male | -0.03895 | 0.02917 | -1.335 | -0.09613 | 0.01823 | fixed |
| sibling_count3 | 0.007197 | 0.05516 | 0.1305 | -0.1009 | 0.1153 | fixed |
| sibling_count4 | -0.1165 | 0.05801 | -2.009 | -0.2302 | -0.002827 | fixed |
| sibling_count5 | -0.2102 | 0.06492 | -3.237 | -0.3374 | -0.08293 | fixed |
| sibling_count5+ | -0.4215 | 0.06445 | -6.539 | -0.5478 | -0.2951 | fixed |
| sd_(Intercept).mother_pidlink | 0.5393 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7441 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.529 | 3.662 | -1.783 | -13.71 | 0.648 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7555 | 0.381 | 1.983 | 0.008815 | 1.502 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02643 | 0.01302 | -2.03 | -0.05195 | -0.0009143 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002976 | 0.0001463 | 2.034 | 0.00001085 | 0.0005843 | fixed |
| male | -0.03853 | 0.02917 | -1.321 | -0.09571 | 0.01864 | fixed |
| sibling_count3 | 0.002132 | 0.05581 | 0.03821 | -0.1073 | 0.1115 | fixed |
| sibling_count4 | -0.124 | 0.0598 | -2.074 | -0.2412 | -0.006812 | fixed |
| sibling_count5 | -0.2096 | 0.06759 | -3.101 | -0.342 | -0.07709 | fixed |
| sibling_count5+ | -0.4414 | 0.06577 | -6.711 | -0.5703 | -0.3125 | fixed |
| birth_order_nonlinear2 | 0.009153 | 0.03802 | 0.2407 | -0.06536 | 0.08367 | fixed |
| birth_order_nonlinear3 | 0.06512 | 0.04521 | 1.441 | -0.02348 | 0.1537 | fixed |
| birth_order_nonlinear4 | 0.07384 | 0.05563 | 1.327 | -0.03519 | 0.1829 | fixed |
| birth_order_nonlinear5 | 0.0474 | 0.06735 | 0.7038 | -0.08461 | 0.1794 | fixed |
| birth_order_nonlinear5+ | 0.1984 | 0.06874 | 2.886 | 0.06366 | 0.3331 | fixed |
| sd_(Intercept).mother_pidlink | 0.5393 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7441 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.77 | 3.663 | -1.848 | -13.95 | 0.4091 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7853 | 0.381 | 2.061 | 0.03849 | 1.532 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02747 | 0.01302 | -2.11 | -0.05299 | -0.001948 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003095 | 0.0001463 | 2.115 | 0.0000227 | 0.0005962 | fixed |
| male | -0.03938 | 0.02918 | -1.349 | -0.09658 | 0.01782 | fixed |
| count_birth_order2/2 | -0.1061 | 0.07239 | -1.466 | -0.248 | 0.03578 | fixed |
| count_birth_order1/3 | -0.04743 | 0.06861 | -0.6912 | -0.1819 | 0.08705 | fixed |
| count_birth_order2/3 | 0.0001341 | 0.07494 | 0.001789 | -0.1467 | 0.147 | fixed |
| count_birth_order3/3 | 0.002427 | 0.08289 | 0.02927 | -0.16 | 0.1649 | fixed |
| count_birth_order1/4 | -0.1624 | 0.07978 | -2.036 | -0.3188 | -0.006039 | fixed |
| count_birth_order2/4 | -0.1517 | 0.08132 | -1.865 | -0.3111 | 0.007689 | fixed |
| count_birth_order3/4 | -0.203 | 0.08231 | -2.466 | -0.3643 | -0.04165 | fixed |
| count_birth_order4/4 | 0.02222 | 0.08949 | 0.2483 | -0.1532 | 0.1976 | fixed |
| count_birth_order1/5 | -0.258 | 0.1027 | -2.511 | -0.4593 | -0.05663 | fixed |
| count_birth_order2/5 | -0.3278 | 0.1062 | -3.088 | -0.5359 | -0.1197 | fixed |
| count_birth_order3/5 | -0.05324 | 0.09669 | -0.5506 | -0.2427 | 0.1363 | fixed |
| count_birth_order4/5 | -0.2332 | 0.09627 | -2.423 | -0.4219 | -0.04454 | fixed |
| count_birth_order5/5 | -0.2 | 0.1008 | -1.984 | -0.3975 | -0.002421 | fixed |
| count_birth_order1/5+ | -0.5937 | 0.0977 | -6.077 | -0.7852 | -0.4022 | fixed |
| count_birth_order2/5+ | -0.361 | 0.09474 | -3.811 | -0.5467 | -0.1753 | fixed |
| count_birth_order3/5+ | -0.3577 | 0.0892 | -4.01 | -0.5326 | -0.1829 | fixed |
| count_birth_order4/5+ | -0.471 | 0.08863 | -5.314 | -0.6447 | -0.2973 | fixed |
| count_birth_order5/5+ | -0.4359 | 0.08616 | -5.059 | -0.6048 | -0.267 | fixed |
| count_birth_order5+/5+ | -0.2855 | 0.06908 | -4.133 | -0.4209 | -0.1501 | fixed |
| sd_(Intercept).mother_pidlink | 0.5405 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7422 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 9408 | 9476 | -4693 | 9386 | NA | NA | NA |
| 12 | 9404 | 9478 | -4690 | 9380 | 5.676 | 1 | 0.01719 |
| 16 | 9408 | 9507 | -4688 | 9376 | 4.108 | 4 | 0.3915 |
| 26 | 9409 | 9570 | -4679 | 9357 | 18.76 | 10 | 0.04348 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.46 | 3.656 | -1.767 | -13.63 | 0.7058 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7521 | 0.3804 | 1.977 | 0.006589 | 1.498 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02635 | 0.013 | -2.026 | -0.05183 | -0.0008642 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002955 | 0.0001461 | 2.023 | 0.000009182 | 0.0005818 | fixed |
| male | -0.03596 | 0.02916 | -1.233 | -0.09311 | 0.02119 | fixed |
| sibling_count3 | -0.01256 | 0.06097 | -0.2061 | -0.1321 | 0.1069 | fixed |
| sibling_count4 | -0.06261 | 0.06183 | -1.013 | -0.1838 | 0.05857 | fixed |
| sibling_count5 | -0.1069 | 0.06451 | -1.657 | -0.2333 | 0.01954 | fixed |
| sibling_count5+ | -0.2746 | 0.0561 | -4.896 | -0.3846 | -0.1647 | fixed |
| sd_(Intercept).mother_pidlink | 0.5448 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7446 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.577 | 3.657 | -1.799 | -13.74 | 0.5897 | fixed |
| birth_order | 0.009836 | 0.008549 | 1.151 | -0.006918 | 0.02659 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7626 | 0.3804 | 2.005 | 0.01701 | 1.508 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02672 | 0.013 | -2.055 | -0.0522 | -0.001234 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003002 | 0.0001461 | 2.055 | 0.00001383 | 0.0005865 | fixed |
| male | -0.03681 | 0.02917 | -1.262 | -0.09397 | 0.02035 | fixed |
| sibling_count3 | -0.01729 | 0.06112 | -0.2829 | -0.1371 | 0.1025 | fixed |
| sibling_count4 | -0.07328 | 0.06253 | -1.172 | -0.1958 | 0.04928 | fixed |
| sibling_count5 | -0.1237 | 0.06615 | -1.87 | -0.2533 | 0.005958 | fixed |
| sibling_count5+ | -0.31 | 0.06394 | -4.847 | -0.4353 | -0.1846 | fixed |
| sd_(Intercept).mother_pidlink | 0.5453 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7443 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.802 | 3.663 | -1.857 | -13.98 | 0.3766 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.787 | 0.381 | 2.065 | 0.04012 | 1.534 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02754 | 0.01302 | -2.115 | -0.05307 | -0.002019 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003094 | 0.0001463 | 2.115 | 0.00002266 | 0.0005962 | fixed |
| male | -0.03809 | 0.02917 | -1.306 | -0.09527 | 0.01909 | fixed |
| sibling_count3 | -0.01862 | 0.06182 | -0.3012 | -0.1398 | 0.1026 | fixed |
| sibling_count4 | -0.07304 | 0.06402 | -1.141 | -0.1985 | 0.05243 | fixed |
| sibling_count5 | -0.1131 | 0.06838 | -1.654 | -0.2472 | 0.0209 | fixed |
| sibling_count5+ | -0.3226 | 0.06534 | -4.937 | -0.4507 | -0.1945 | fixed |
| birth_order_nonlinear2 | 0.006261 | 0.03896 | 0.1607 | -0.0701 | 0.08262 | fixed |
| birth_order_nonlinear3 | 0.02381 | 0.04523 | 0.5263 | -0.06485 | 0.1125 | fixed |
| birth_order_nonlinear4 | 0.01933 | 0.05432 | 0.3559 | -0.08713 | 0.1258 | fixed |
| birth_order_nonlinear5 | -0.01933 | 0.06473 | -0.2986 | -0.1462 | 0.1075 | fixed |
| birth_order_nonlinear5+ | 0.1189 | 0.06293 | 1.89 | -0.004426 | 0.2422 | fixed |
| sd_(Intercept).mother_pidlink | 0.5463 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7437 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.278 | 3.674 | -1.981 | -14.48 | -0.07648 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8385 | 0.3822 | 2.194 | 0.08932 | 1.588 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02931 | 0.01306 | -2.244 | -0.05491 | -0.003709 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003294 | 0.0001467 | 2.245 | 0.00004183 | 0.000617 | fixed |
| male | -0.03995 | 0.02924 | -1.366 | -0.09725 | 0.01735 | fixed |
| count_birth_order2/2 | -0.04316 | 0.08217 | -0.5253 | -0.2042 | 0.1179 | fixed |
| count_birth_order1/3 | -0.06737 | 0.07659 | -0.8796 | -0.2175 | 0.08275 | fixed |
| count_birth_order2/3 | 0.01362 | 0.08304 | 0.164 | -0.1491 | 0.1764 | fixed |
| count_birth_order3/3 | -0.008673 | 0.09006 | -0.0963 | -0.1852 | 0.1678 | fixed |
| count_birth_order1/4 | -0.06541 | 0.08479 | -0.7714 | -0.2316 | 0.1008 | fixed |
| count_birth_order2/4 | -0.08562 | 0.08554 | -1.001 | -0.2533 | 0.08204 | fixed |
| count_birth_order3/4 | -0.1709 | 0.09005 | -1.898 | -0.3474 | 0.005567 | fixed |
| count_birth_order4/4 | 0.01303 | 0.09927 | 0.1312 | -0.1815 | 0.2076 | fixed |
| count_birth_order1/5 | -0.1005 | 0.09729 | -1.033 | -0.2912 | 0.0902 | fixed |
| count_birth_order2/5 | -0.1612 | 0.1008 | -1.599 | -0.3589 | 0.03638 | fixed |
| count_birth_order3/5 | -0.09824 | 0.1004 | -0.9789 | -0.2949 | 0.09845 | fixed |
| count_birth_order4/5 | -0.2109 | 0.101 | -2.089 | -0.4088 | -0.01305 | fixed |
| count_birth_order5/5 | -0.05866 | 0.1047 | -0.5602 | -0.2639 | 0.1466 | fixed |
| count_birth_order1/5+ | -0.3759 | 0.08989 | -4.182 | -0.5521 | -0.1997 | fixed |
| count_birth_order2/5+ | -0.3399 | 0.09127 | -3.724 | -0.5187 | -0.161 | fixed |
| count_birth_order3/5+ | -0.2308 | 0.08689 | -2.657 | -0.4011 | -0.06054 | fixed |
| count_birth_order4/5+ | -0.3191 | 0.086 | -3.71 | -0.4876 | -0.1505 | fixed |
| count_birth_order5/5+ | -0.4139 | 0.08772 | -4.718 | -0.5858 | -0.2419 | fixed |
| count_birth_order5+/5+ | -0.2232 | 0.0714 | -3.126 | -0.3631 | -0.08326 | fixed |
| sd_(Intercept).mother_pidlink | 0.5457 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7438 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 9482 | 9550 | -4730 | 9460 | NA | NA | NA |
| 12 | 9483 | 9557 | -4729 | 9459 | 1.325 | 1 | 0.2496 |
| 16 | 9487 | 9586 | -4728 | 9455 | 3.804 | 4 | 0.4332 |
| 26 | 9496 | 9657 | -4722 | 9444 | 11.35 | 10 | 0.3306 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.076 | 3.679 | -1.923 | -14.29 | 0.1352 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8127 | 0.3827 | 2.124 | 0.06267 | 1.563 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02836 | 0.01307 | -2.169 | -0.05398 | -0.002738 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003175 | 0.0001468 | 2.162 | 0.00002971 | 0.0006053 | fixed |
| male | -0.04285 | 0.02939 | -1.458 | -0.1004 | 0.01475 | fixed |
| sibling_count3 | 0.02927 | 0.05419 | 0.5401 | -0.07694 | 0.1355 | fixed |
| sibling_count4 | -0.04721 | 0.05629 | -0.8387 | -0.1575 | 0.06311 | fixed |
| sibling_count5 | -0.1309 | 0.06315 | -2.073 | -0.2547 | -0.007122 | fixed |
| sibling_count5+ | -0.2998 | 0.05394 | -5.557 | -0.4055 | -0.1941 | fixed |
| sd_(Intercept).mother_pidlink | 0.5428 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7428 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.32 | 3.679 | -1.99 | -14.53 | -0.1093 | fixed |
| birth_order | 0.02161 | 0.009902 | 2.182 | 0.002199 | 0.04101 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8336 | 0.3825 | 2.179 | 0.08381 | 1.583 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02909 | 0.01307 | -2.226 | -0.0547 | -0.003472 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003266 | 0.0001468 | 2.225 | 0.00003884 | 0.0006143 | fixed |
| male | -0.04449 | 0.02938 | -1.514 | -0.1021 | 0.01309 | fixed |
| sibling_count3 | 0.01921 | 0.05436 | 0.3534 | -0.08733 | 0.1258 | fixed |
| sibling_count4 | -0.07241 | 0.05744 | -1.261 | -0.185 | 0.04017 | fixed |
| sibling_count5 | -0.1701 | 0.06564 | -2.592 | -0.2988 | -0.0415 | fixed |
| sibling_count5+ | -0.3787 | 0.06491 | -5.833 | -0.5059 | -0.2514 | fixed |
| sd_(Intercept).mother_pidlink | 0.5429 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7423 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.42 | 3.683 | -2.015 | -14.64 | -0.202 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8467 | 0.383 | 2.211 | 0.09602 | 1.597 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02955 | 0.01308 | -2.258 | -0.05519 | -0.003901 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000332 | 0.000147 | 2.259 | 0.00004392 | 0.00062 | fixed |
| male | -0.04381 | 0.02937 | -1.492 | -0.1014 | 0.01376 | fixed |
| sibling_count3 | 0.01676 | 0.05507 | 0.3044 | -0.09117 | 0.1247 | fixed |
| sibling_count4 | -0.07309 | 0.05928 | -1.233 | -0.1893 | 0.0431 | fixed |
| sibling_count5 | -0.1642 | 0.06813 | -2.41 | -0.2978 | -0.03069 | fixed |
| sibling_count5+ | -0.4014 | 0.06633 | -6.051 | -0.5314 | -0.2714 | fixed |
| birth_order_nonlinear2 | 0.01263 | 0.03785 | 0.3338 | -0.06155 | 0.08682 | fixed |
| birth_order_nonlinear3 | 0.0498 | 0.045 | 1.107 | -0.03841 | 0.138 | fixed |
| birth_order_nonlinear4 | 0.05286 | 0.05643 | 0.9368 | -0.05774 | 0.1635 | fixed |
| birth_order_nonlinear5 | 0.0456 | 0.0695 | 0.6561 | -0.09062 | 0.1818 | fixed |
| birth_order_nonlinear5+ | 0.2082 | 0.07078 | 2.941 | 0.06945 | 0.3469 | fixed |
| sd_(Intercept).mother_pidlink | 0.5432 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.742 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.49 | 3.684 | -2.033 | -14.71 | -0.2699 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8596 | 0.3831 | 2.244 | 0.1088 | 1.61 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03005 | 0.01309 | -2.296 | -0.0557 | -0.004402 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003384 | 0.000147 | 2.302 | 0.00005028 | 0.0006264 | fixed |
| male | -0.04343 | 0.0294 | -1.477 | -0.1011 | 0.0142 | fixed |
| count_birth_order2/2 | -0.08876 | 0.07016 | -1.265 | -0.2263 | 0.04875 | fixed |
| count_birth_order1/3 | -0.03279 | 0.06767 | -0.4846 | -0.1654 | 0.09984 | fixed |
| count_birth_order2/3 | 0.03804 | 0.07462 | 0.5098 | -0.1082 | 0.1843 | fixed |
| count_birth_order3/3 | -0.002867 | 0.08072 | -0.03551 | -0.1611 | 0.1553 | fixed |
| count_birth_order1/4 | -0.09423 | 0.07942 | -1.186 | -0.2499 | 0.06143 | fixed |
| count_birth_order2/4 | -0.09867 | 0.0809 | -1.22 | -0.2572 | 0.05988 | fixed |
| count_birth_order3/4 | -0.1327 | 0.08217 | -1.614 | -0.2937 | 0.0284 | fixed |
| count_birth_order4/4 | 0.003595 | 0.0882 | 0.04076 | -0.1693 | 0.1765 | fixed |
| count_birth_order1/5 | -0.2386 | 0.1019 | -2.341 | -0.4383 | -0.03884 | fixed |
| count_birth_order2/5 | -0.3413 | 0.1077 | -3.169 | -0.5524 | -0.1302 | fixed |
| count_birth_order3/5 | -0.01051 | 0.09789 | -0.1074 | -0.2024 | 0.1814 | fixed |
| count_birth_order4/5 | -0.1728 | 0.09876 | -1.75 | -0.3664 | 0.02074 | fixed |
| count_birth_order5/5 | -0.1006 | 0.1067 | -0.9431 | -0.3098 | 0.1085 | fixed |
| count_birth_order1/5+ | -0.5258 | 0.09991 | -5.263 | -0.7216 | -0.33 | fixed |
| count_birth_order2/5+ | -0.2842 | 0.09785 | -2.904 | -0.4759 | -0.09238 | fixed |
| count_birth_order3/5+ | -0.3577 | 0.08934 | -4.004 | -0.5328 | -0.1826 | fixed |
| count_birth_order4/5+ | -0.4301 | 0.09133 | -4.709 | -0.6091 | -0.251 | fixed |
| count_birth_order5/5+ | -0.4212 | 0.08699 | -4.841 | -0.5917 | -0.2507 | fixed |
| count_birth_order5+/5+ | -0.2325 | 0.06976 | -3.333 | -0.3692 | -0.0958 | fixed |
| sd_(Intercept).mother_pidlink | 0.5445 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7403 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 9245 | 9313 | -4612 | 9223 | NA | NA | NA |
| 12 | 9243 | 9317 | -4609 | 9219 | 4.77 | 1 | 0.02896 |
| 16 | 9246 | 9345 | -4607 | 9214 | 4.686 | 4 | 0.3211 |
| 26 | 9249 | 9409 | -4598 | 9197 | 17.2 | 10 | 0.07015 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = g_factor_2007_young)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.75 | 0.4555 | -17.02 | -8.643 | -6.857 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8809 | 0.0619 | 14.23 | 0.7596 | 1.002 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02996 | 0.002746 | -10.91 | -0.03534 | -0.02458 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003113 | 0.00004013 | 7.759 | 0.0002327 | 0.00039 | fixed |
| male | -0.05593 | 0.01849 | -3.025 | -0.09217 | -0.01969 | fixed |
| sibling_count3 | 0.003237 | 0.04136 | 0.07825 | -0.07783 | 0.0843 | fixed |
| sibling_count4 | -0.1427 | 0.04228 | -3.375 | -0.2255 | -0.05982 | fixed |
| sibling_count5 | -0.09449 | 0.04566 | -2.069 | -0.184 | -0.004994 | fixed |
| sibling_count5+ | -0.307 | 0.03653 | -8.404 | -0.3786 | -0.2354 | fixed |
| sd_(Intercept).mother_pidlink | 0.5847 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7533 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.749 | 0.4555 | -17.01 | -8.642 | -6.857 | fixed |
| birth_order | 0.0005934 | 0.004302 | 0.1379 | -0.007839 | 0.009026 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8806 | 0.06194 | 14.22 | 0.7592 | 1.002 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02995 | 0.002748 | -10.9 | -0.03533 | -0.02456 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003112 | 0.00004015 | 7.751 | 0.0002325 | 0.0003899 | fixed |
| male | -0.05597 | 0.01849 | -3.027 | -0.09222 | -0.01973 | fixed |
| sibling_count3 | 0.002934 | 0.04142 | 0.07082 | -0.07825 | 0.08412 | fixed |
| sibling_count4 | -0.1434 | 0.04256 | -3.368 | -0.2268 | -0.05994 | fixed |
| sibling_count5 | -0.09562 | 0.0464 | -2.061 | -0.1866 | -0.004681 | fixed |
| sibling_count5+ | -0.3102 | 0.04325 | -7.173 | -0.395 | -0.2254 | fixed |
| sd_(Intercept).mother_pidlink | 0.5847 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7533 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.8 | 0.4563 | -17.1 | -8.694 | -6.906 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8848 | 0.06196 | 14.28 | 0.7634 | 1.006 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03011 | 0.002748 | -10.96 | -0.0355 | -0.02473 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003133 | 0.00004015 | 7.803 | 0.0002346 | 0.0003919 | fixed |
| male | -0.05596 | 0.01849 | -3.026 | -0.0922 | -0.01972 | fixed |
| sibling_count3 | 0.001285 | 0.04195 | 0.03064 | -0.08093 | 0.0835 | fixed |
| sibling_count4 | -0.149 | 0.04393 | -3.391 | -0.2351 | -0.06288 | fixed |
| sibling_count5 | -0.08941 | 0.04865 | -1.838 | -0.1848 | 0.005933 | fixed |
| sibling_count5+ | -0.3059 | 0.04589 | -6.664 | -0.3958 | -0.2159 | fixed |
| birth_order_nonlinear2 | 0.06189 | 0.02732 | 2.265 | 0.00834 | 0.1154 | fixed |
| birth_order_nonlinear3 | 0.006896 | 0.0318 | 0.2168 | -0.05544 | 0.06923 | fixed |
| birth_order_nonlinear4 | 0.03344 | 0.03735 | 0.8952 | -0.03977 | 0.1066 | fixed |
| birth_order_nonlinear5 | -0.02553 | 0.04219 | -0.6052 | -0.1082 | 0.05715 | fixed |
| birth_order_nonlinear5+ | 0.0216 | 0.03841 | 0.5622 | -0.05369 | 0.09689 | fixed |
| sd_(Intercept).mother_pidlink | 0.5844 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7533 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.852 | 0.4568 | -17.19 | -8.747 | -6.957 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8906 | 0.06197 | 14.37 | 0.7692 | 1.012 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03034 | 0.002748 | -11.04 | -0.03573 | -0.02495 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003159 | 0.00004014 | 7.87 | 0.0002372 | 0.0003946 | fixed |
| male | -0.05667 | 0.0185 | -3.064 | -0.09292 | -0.02042 | fixed |
| count_birth_order2/2 | 0.08138 | 0.05571 | 1.461 | -0.02781 | 0.1906 | fixed |
| count_birth_order1/3 | 0.005201 | 0.05054 | 0.1029 | -0.09385 | 0.1043 | fixed |
| count_birth_order2/3 | 0.0915 | 0.05554 | 1.648 | -0.01735 | 0.2004 | fixed |
| count_birth_order3/3 | -0.01376 | 0.06223 | -0.2212 | -0.1357 | 0.1082 | fixed |
| count_birth_order1/4 | -0.1705 | 0.05732 | -2.974 | -0.2828 | -0.05815 | fixed |
| count_birth_order2/4 | -0.09368 | 0.05859 | -1.599 | -0.2085 | 0.02115 | fixed |
| count_birth_order3/4 | -0.1673 | 0.06116 | -2.735 | -0.2872 | -0.04741 | fixed |
| count_birth_order4/4 | -0.006893 | 0.06672 | -0.1033 | -0.1377 | 0.1239 | fixed |
| count_birth_order1/5 | -0.1206 | 0.0694 | -1.738 | -0.2567 | 0.01539 | fixed |
| count_birth_order2/5 | -0.06432 | 0.07317 | -0.879 | -0.2077 | 0.07909 | fixed |
| count_birth_order3/5 | -0.09166 | 0.06978 | -1.314 | -0.2284 | 0.04511 | fixed |
| count_birth_order4/5 | -0.031 | 0.07323 | -0.4233 | -0.1745 | 0.1125 | fixed |
| count_birth_order5/5 | -0.03769 | 0.0714 | -0.5278 | -0.1776 | 0.1023 | fixed |
| count_birth_order1/5+ | -0.2167 | 0.06404 | -3.384 | -0.3422 | -0.09122 | fixed |
| count_birth_order2/5+ | -0.2459 | 0.06271 | -3.921 | -0.3688 | -0.123 | fixed |
| count_birth_order3/5+ | -0.2307 | 0.0588 | -3.923 | -0.3459 | -0.1154 | fixed |
| count_birth_order4/5+ | -0.3284 | 0.0553 | -5.94 | -0.4368 | -0.2201 | fixed |
| count_birth_order5/5+ | -0.3523 | 0.05331 | -6.608 | -0.4568 | -0.2478 | fixed |
| count_birth_order5+/5+ | -0.2805 | 0.0418 | -6.711 | -0.3625 | -0.1986 | fixed |
| sd_(Intercept).mother_pidlink | 0.583 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7537 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 24501 | 24580 | -12240 | 24479 | NA | NA | NA |
| 12 | 24503 | 24589 | -12240 | 24479 | 0.01897 | 1 | 0.8905 |
| 16 | 24503 | 24617 | -12236 | 24471 | 7.893 | 4 | 0.09557 |
| 26 | 24508 | 24693 | -12228 | 24456 | 15.5 | 10 | 0.1149 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -8.275 | 0.9556 | -8.659 | -10.15 | -6.402 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.9443 | 0.1428 | 6.611 | 0.6643 | 1.224 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03243 | 0.006949 | -4.667 | -0.04605 | -0.01881 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003491 | 0.0001103 | 3.167 | 0.000133 | 0.0005652 | fixed |
| male | -0.08542 | 0.02318 | -3.686 | -0.1308 | -0.04 | fixed |
| sibling_count3 | 0.01038 | 0.03598 | 0.2884 | -0.06015 | 0.08091 | fixed |
| sibling_count4 | -0.09441 | 0.0408 | -2.314 | -0.1744 | -0.01444 | fixed |
| sibling_count5 | -0.1658 | 0.04931 | -3.363 | -0.2625 | -0.06919 | fixed |
| sibling_count5+ | -0.252 | 0.04407 | -5.719 | -0.3384 | -0.1657 | fixed |
| sd_(Intercept).mother_pidlink | 0.54 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7094 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -8.376 | 0.9564 | -8.758 | -10.25 | -6.502 | fixed |
| birth_order | 0.01868 | 0.008975 | 2.081 | 0.001089 | 0.03627 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.9548 | 0.1428 | 6.684 | 0.6748 | 1.235 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03293 | 0.006949 | -4.739 | -0.04655 | -0.01931 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003577 | 0.0001103 | 3.244 | 0.0001416 | 0.0005739 | fixed |
| male | -0.08599 | 0.02317 | -3.712 | -0.1314 | -0.04058 | fixed |
| sibling_count3 | 0.001063 | 0.03626 | 0.02931 | -0.07 | 0.07213 | fixed |
| sibling_count4 | -0.117 | 0.04221 | -2.771 | -0.1997 | -0.03423 | fixed |
| sibling_count5 | -0.2044 | 0.05268 | -3.881 | -0.3077 | -0.1012 | fixed |
| sibling_count5+ | -0.3352 | 0.05947 | -5.636 | -0.4517 | -0.2186 | fixed |
| sd_(Intercept).mother_pidlink | 0.5404 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7088 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -8.405 | 0.9573 | -8.78 | -10.28 | -6.529 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.9598 | 0.143 | 6.713 | 0.6796 | 1.24 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03314 | 0.006955 | -4.765 | -0.04677 | -0.01951 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003606 | 0.0001104 | 3.267 | 0.0001443 | 0.0005769 | fixed |
| male | -0.08615 | 0.02318 | -3.717 | -0.1316 | -0.04072 | fixed |
| sibling_count3 | -0.001466 | 0.03707 | -0.03955 | -0.07413 | 0.0712 | fixed |
| sibling_count4 | -0.1162 | 0.04424 | -2.626 | -0.2029 | -0.02945 | fixed |
| sibling_count5 | -0.2014 | 0.056 | -3.596 | -0.3111 | -0.09159 | fixed |
| sibling_count5+ | -0.3416 | 0.0622 | -5.492 | -0.4635 | -0.2197 | fixed |
| birth_order_nonlinear2 | 0.04855 | 0.02829 | 1.716 | -0.006898 | 0.104 | fixed |
| birth_order_nonlinear3 | 0.04855 | 0.03718 | 1.306 | -0.02431 | 0.1214 | fixed |
| birth_order_nonlinear4 | 0.04994 | 0.04837 | 1.032 | -0.04488 | 0.1447 | fixed |
| birth_order_nonlinear5 | 0.07905 | 0.0628 | 1.259 | -0.04403 | 0.2021 | fixed |
| birth_order_nonlinear5+ | 0.1498 | 0.06863 | 2.182 | 0.01526 | 0.2843 | fixed |
| sd_(Intercept).mother_pidlink | 0.5404 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.709 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -8.377 | 0.9586 | -8.739 | -10.26 | -6.498 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.9561 | 0.1432 | 6.677 | 0.6754 | 1.237 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03296 | 0.006966 | -4.731 | -0.04661 | -0.01931 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003578 | 0.0001105 | 3.237 | 0.0001411 | 0.0005744 | fixed |
| male | -0.08551 | 0.02321 | -3.685 | -0.131 | -0.04003 | fixed |
| count_birth_order2/2 | 0.03458 | 0.04653 | 0.7431 | -0.05662 | 0.1258 | fixed |
| count_birth_order1/3 | -0.01329 | 0.0451 | -0.2946 | -0.1017 | 0.0751 | fixed |
| count_birth_order2/3 | 0.06255 | 0.04894 | 1.278 | -0.03337 | 0.1585 | fixed |
| count_birth_order3/3 | 0.03125 | 0.05458 | 0.5726 | -0.07571 | 0.1382 | fixed |
| count_birth_order1/4 | -0.1189 | 0.06051 | -1.964 | -0.2375 | -0.0002613 | fixed |
| count_birth_order2/4 | -0.1218 | 0.06038 | -2.017 | -0.2401 | -0.003439 | fixed |
| count_birth_order3/4 | -0.0876 | 0.06289 | -1.393 | -0.2109 | 0.03566 | fixed |
| count_birth_order4/4 | -0.01094 | 0.06259 | -0.1747 | -0.1336 | 0.1117 | fixed |
| count_birth_order1/5 | -0.1497 | 0.09123 | -1.641 | -0.3285 | 0.02912 | fixed |
| count_birth_order2/5 | -0.1942 | 0.09599 | -2.023 | -0.3823 | -0.006023 | fixed |
| count_birth_order3/5 | -0.2281 | 0.08465 | -2.694 | -0.394 | -0.06215 | fixed |
| count_birth_order4/5 | -0.1943 | 0.07964 | -2.44 | -0.3504 | -0.0382 | fixed |
| count_birth_order5/5 | -0.06289 | 0.0773 | -0.8136 | -0.2144 | 0.08861 | fixed |
| count_birth_order1/5+ | -0.4313 | 0.1114 | -3.872 | -0.6497 | -0.213 | fixed |
| count_birth_order2/5+ | -0.151 | 0.1092 | -1.382 | -0.3651 | 0.06312 | fixed |
| count_birth_order3/5+ | -0.1233 | 0.0948 | -1.3 | -0.3091 | 0.06252 | fixed |
| count_birth_order4/5+ | -0.3679 | 0.08502 | -4.327 | -0.5345 | -0.2012 | fixed |
| count_birth_order5/5+ | -0.3301 | 0.07643 | -4.319 | -0.4799 | -0.1803 | fixed |
| count_birth_order5+/5+ | -0.2001 | 0.05454 | -3.669 | -0.307 | -0.09319 | fixed |
| sd_(Intercept).mother_pidlink | 0.5386 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7095 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 13668 | 13740 | -6823 | 13646 | NA | NA | NA |
| 12 | 13665 | 13744 | -6821 | 13641 | 4.336 | 1 | 0.03732 |
| 16 | 13671 | 13776 | -6820 | 13639 | 2.188 | 4 | 0.7013 |
| 26 | 13676 | 13847 | -6812 | 13624 | 15.01 | 10 | 0.1318 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -8.245 | 0.9545 | -8.638 | -10.12 | -6.374 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.9423 | 0.1426 | 6.607 | 0.6627 | 1.222 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03235 | 0.00694 | -4.661 | -0.04595 | -0.01874 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003477 | 0.0001101 | 3.157 | 0.0001318 | 0.0005635 | fixed |
| male | -0.08633 | 0.02311 | -3.735 | -0.1316 | -0.04103 | fixed |
| sibling_count3 | -0.01 | 0.03871 | -0.2584 | -0.08587 | 0.06587 | fixed |
| sibling_count4 | -0.07904 | 0.04223 | -1.872 | -0.1618 | 0.003723 | fixed |
| sibling_count5 | -0.1368 | 0.04772 | -2.866 | -0.2303 | -0.04323 | fixed |
| sibling_count5+ | -0.2154 | 0.04124 | -5.222 | -0.2962 | -0.1345 | fixed |
| sd_(Intercept).mother_pidlink | 0.5413 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7093 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -8.302 | 0.9557 | -8.687 | -10.18 | -6.429 | fixed |
| birth_order | 0.008746 | 0.00768 | 1.139 | -0.006307 | 0.0238 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.9486 | 0.1427 | 6.647 | 0.6689 | 1.228 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03264 | 0.006944 | -4.701 | -0.04625 | -0.01903 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003526 | 0.0001102 | 3.2 | 0.0001366 | 0.0005686 | fixed |
| male | -0.08669 | 0.02311 | -3.751 | -0.132 | -0.0414 | fixed |
| sibling_count3 | -0.01448 | 0.03891 | -0.3721 | -0.09074 | 0.06178 | fixed |
| sibling_count4 | -0.08899 | 0.04312 | -2.064 | -0.1735 | -0.00447 | fixed |
| sibling_count5 | -0.1535 | 0.04993 | -3.074 | -0.2513 | -0.05561 | fixed |
| sibling_count5+ | -0.2514 | 0.05196 | -4.838 | -0.3532 | -0.1495 | fixed |
| sd_(Intercept).mother_pidlink | 0.5416 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7091 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -8.348 | 0.9563 | -8.729 | -10.22 | -6.474 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.953 | 0.1428 | 6.673 | 0.6731 | 1.233 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0328 | 0.006948 | -4.721 | -0.04642 | -0.01918 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003543 | 0.0001103 | 3.213 | 0.0001382 | 0.0005704 | fixed |
| male | -0.08662 | 0.02312 | -3.746 | -0.1319 | -0.0413 | fixed |
| sibling_count3 | -0.0152 | 0.0397 | -0.3828 | -0.09301 | 0.06262 | fixed |
| sibling_count4 | -0.09031 | 0.04495 | -2.009 | -0.1784 | -0.002209 | fixed |
| sibling_count5 | -0.1564 | 0.05279 | -2.962 | -0.2598 | -0.05289 | fixed |
| sibling_count5+ | -0.2465 | 0.05381 | -4.581 | -0.352 | -0.1411 | fixed |
| birth_order_nonlinear2 | 0.0624 | 0.02904 | 2.148 | 0.005474 | 0.1193 | fixed |
| birth_order_nonlinear3 | 0.01888 | 0.0368 | 0.513 | -0.05325 | 0.09101 | fixed |
| birth_order_nonlinear4 | 0.04156 | 0.04626 | 0.8983 | -0.04911 | 0.1322 | fixed |
| birth_order_nonlinear5 | 0.06251 | 0.05747 | 1.088 | -0.05012 | 0.1751 | fixed |
| birth_order_nonlinear5+ | 0.06343 | 0.05866 | 1.081 | -0.05154 | 0.1784 | fixed |
| sd_(Intercept).mother_pidlink | 0.541 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7094 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -8.352 | 0.9571 | -8.727 | -10.23 | -6.476 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.9532 | 0.143 | 6.668 | 0.6731 | 1.233 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03285 | 0.006955 | -4.723 | -0.04648 | -0.01922 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003559 | 0.0001104 | 3.225 | 0.0001396 | 0.0005723 | fixed |
| male | -0.08717 | 0.02314 | -3.767 | -0.1325 | -0.04181 | fixed |
| count_birth_order2/2 | 0.08017 | 0.05117 | 1.567 | -0.02011 | 0.1805 | fixed |
| count_birth_order1/3 | -0.02997 | 0.0487 | -0.6153 | -0.1254 | 0.06549 | fixed |
| count_birth_order2/3 | 0.06372 | 0.05225 | 1.22 | -0.03868 | 0.1661 | fixed |
| count_birth_order3/3 | 0.03225 | 0.05864 | 0.5499 | -0.08269 | 0.1472 | fixed |
| count_birth_order1/4 | -0.1036 | 0.06091 | -1.701 | -0.223 | 0.01577 | fixed |
| count_birth_order2/4 | -0.06062 | 0.06142 | -0.9869 | -0.181 | 0.05976 | fixed |
| count_birth_order3/4 | -0.09628 | 0.06447 | -1.493 | -0.2226 | 0.03007 | fixed |
| count_birth_order4/4 | 0.04985 | 0.0662 | 0.7531 | -0.0799 | 0.1796 | fixed |
| count_birth_order1/5 | -0.06508 | 0.0825 | -0.7889 | -0.2268 | 0.0966 | fixed |
| count_birth_order2/5 | -0.09482 | 0.08333 | -1.138 | -0.2581 | 0.06852 | fixed |
| count_birth_order3/5 | -0.1679 | 0.0795 | -2.112 | -0.3238 | -0.01212 | fixed |
| count_birth_order4/5 | -0.2076 | 0.07996 | -2.596 | -0.3643 | -0.05089 | fixed |
| count_birth_order5/5 | -0.04856 | 0.07683 | -0.6321 | -0.1992 | 0.102 | fixed |
| count_birth_order1/5+ | -0.175 | 0.08175 | -2.141 | -0.3352 | -0.01479 | fixed |
| count_birth_order2/5+ | -0.1714 | 0.09119 | -1.88 | -0.3502 | 0.007309 | fixed |
| count_birth_order3/5+ | -0.1815 | 0.07965 | -2.278 | -0.3376 | -0.02535 | fixed |
| count_birth_order4/5+ | -0.2455 | 0.0742 | -3.309 | -0.3909 | -0.1001 | fixed |
| count_birth_order5/5+ | -0.2204 | 0.0712 | -3.095 | -0.3599 | -0.08083 | fixed |
| count_birth_order5+/5+ | -0.181 | 0.0521 | -3.475 | -0.2831 | -0.07891 | fixed |
| sd_(Intercept).mother_pidlink | 0.5413 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7092 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 13795 | 13868 | -6887 | 13773 | NA | NA | NA |
| 12 | 13796 | 13875 | -6886 | 13772 | 1.298 | 1 | 0.2546 |
| 16 | 13800 | 13905 | -6884 | 13768 | 4.17 | 4 | 0.3834 |
| 26 | 13809 | 13980 | -6879 | 13757 | 10.89 | 10 | 0.3661 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -8.141 | 0.9673 | -8.417 | -10.04 | -6.246 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.9223 | 0.1445 | 6.383 | 0.6391 | 1.206 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03139 | 0.007027 | -4.468 | -0.04517 | -0.01762 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003331 | 0.0001114 | 2.989 | 0.0001147 | 0.0005515 | fixed |
| male | -0.08552 | 0.02357 | -3.628 | -0.1317 | -0.03932 | fixed |
| sibling_count3 | 0.03226 | 0.03609 | 0.8939 | -0.03847 | 0.103 | fixed |
| sibling_count4 | -0.07524 | 0.04109 | -1.831 | -0.1558 | 0.005297 | fixed |
| sibling_count5 | -0.184 | 0.05138 | -3.58 | -0.2847 | -0.08326 | fixed |
| sibling_count5+ | -0.2158 | 0.04538 | -4.756 | -0.3048 | -0.1269 | fixed |
| sd_(Intercept).mother_pidlink | 0.5446 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7117 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -8.252 | 0.9682 | -8.523 | -10.15 | -6.355 | fixed |
| birth_order | 0.01932 | 0.009236 | 2.092 | 0.001217 | 0.03742 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.9344 | 0.1445 | 6.465 | 0.6511 | 1.218 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03198 | 0.007028 | -4.551 | -0.04576 | -0.01821 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003432 | 0.0001115 | 3.078 | 0.0001247 | 0.0005617 | fixed |
| male | -0.08584 | 0.02356 | -3.643 | -0.132 | -0.03966 | fixed |
| sibling_count3 | 0.02289 | 0.03636 | 0.6295 | -0.04838 | 0.09417 | fixed |
| sibling_count4 | -0.09874 | 0.0426 | -2.318 | -0.1822 | -0.01526 | fixed |
| sibling_count5 | -0.2229 | 0.05465 | -4.079 | -0.33 | -0.1158 | fixed |
| sibling_count5+ | -0.3012 | 0.06103 | -4.935 | -0.4208 | -0.1816 | fixed |
| sd_(Intercept).mother_pidlink | 0.5451 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.711 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -8.254 | 0.9693 | -8.516 | -10.15 | -6.355 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.9354 | 0.1447 | 6.465 | 0.6519 | 1.219 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.032 | 0.007035 | -4.548 | -0.04579 | -0.01821 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003429 | 0.0001116 | 3.073 | 0.0001242 | 0.0005616 | fixed |
| male | -0.08579 | 0.02358 | -3.639 | -0.132 | -0.03958 | fixed |
| sibling_count3 | 0.01426 | 0.03717 | 0.3837 | -0.0586 | 0.08712 | fixed |
| sibling_count4 | -0.1023 | 0.04469 | -2.29 | -0.1899 | -0.01475 | fixed |
| sibling_count5 | -0.2147 | 0.05797 | -3.704 | -0.3284 | -0.1011 | fixed |
| sibling_count5+ | -0.299 | 0.06396 | -4.675 | -0.4244 | -0.1737 | fixed |
| birth_order_nonlinear2 | 0.04838 | 0.02842 | 1.703 | -0.007317 | 0.1041 | fixed |
| birth_order_nonlinear3 | 0.07743 | 0.0376 | 2.059 | 0.003735 | 0.1511 | fixed |
| birth_order_nonlinear4 | 0.04621 | 0.04966 | 0.9307 | -0.05111 | 0.1435 | fixed |
| birth_order_nonlinear5 | 0.04818 | 0.06612 | 0.7287 | -0.08142 | 0.1778 | fixed |
| birth_order_nonlinear5+ | 0.1435 | 0.07113 | 2.018 | 0.004106 | 0.2829 | fixed |
| sd_(Intercept).mother_pidlink | 0.5447 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7113 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -8.273 | 0.9709 | -8.521 | -10.18 | -6.37 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.938 | 0.145 | 6.471 | 0.6539 | 1.222 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03211 | 0.007048 | -4.555 | -0.04592 | -0.01829 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003444 | 0.0001118 | 3.081 | 0.0001253 | 0.0005636 | fixed |
| male | -0.08458 | 0.02362 | -3.581 | -0.1309 | -0.03828 | fixed |
| count_birth_order2/2 | 0.04107 | 0.04564 | 0.8999 | -0.04838 | 0.1305 | fixed |
| count_birth_order1/3 | 0.002483 | 0.04517 | 0.05496 | -0.08605 | 0.09102 | fixed |
| count_birth_order2/3 | 0.08983 | 0.04961 | 1.811 | -0.0074 | 0.1871 | fixed |
| count_birth_order3/3 | 0.07019 | 0.05485 | 1.28 | -0.03731 | 0.1777 | fixed |
| count_birth_order1/4 | -0.1101 | 0.06158 | -1.789 | -0.2308 | 0.01056 | fixed |
| count_birth_order2/4 | -0.1067 | 0.06099 | -1.75 | -0.2263 | 0.01283 | fixed |
| count_birth_order3/4 | -0.04312 | 0.06324 | -0.6819 | -0.1671 | 0.08082 | fixed |
| count_birth_order4/4 | 0.008634 | 0.06295 | 0.1372 | -0.1147 | 0.132 | fixed |
| count_birth_order1/5 | -0.1416 | 0.09296 | -1.523 | -0.3238 | 0.04063 | fixed |
| count_birth_order2/5 | -0.2404 | 0.1024 | -2.348 | -0.4412 | -0.0397 | fixed |
| count_birth_order3/5 | -0.1764 | 0.08923 | -1.977 | -0.3513 | -0.001481 | fixed |
| count_birth_order4/5 | -0.229 | 0.08433 | -2.716 | -0.3943 | -0.06374 | fixed |
| count_birth_order5/5 | -0.1126 | 0.0824 | -1.367 | -0.2741 | 0.04886 | fixed |
| count_birth_order1/5+ | -0.3354 | 0.1144 | -2.933 | -0.5596 | -0.1113 | fixed |
| count_birth_order2/5+ | -0.159 | 0.1131 | -1.406 | -0.3807 | 0.0627 | fixed |
| count_birth_order3/5+ | -0.06401 | 0.09685 | -0.6609 | -0.2538 | 0.1258 | fixed |
| count_birth_order4/5+ | -0.339 | 0.08979 | -3.776 | -0.515 | -0.163 | fixed |
| count_birth_order5/5+ | -0.309 | 0.08007 | -3.859 | -0.4659 | -0.1521 | fixed |
| count_birth_order5+/5+ | -0.1624 | 0.05637 | -2.881 | -0.2729 | -0.0519 | fixed |
| sd_(Intercept).mother_pidlink | 0.5433 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7118 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 13372 | 13444 | -6675 | 13350 | NA | NA | NA |
| 12 | 13369 | 13448 | -6673 | 13345 | 4.379 | 1 | 0.03639 |
| 16 | 13374 | 13479 | -6671 | 13342 | 3.268 | 4 | 0.514 |
| 26 | 13381 | 13552 | -6665 | 13329 | 12.8 | 10 | 0.2351 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = raven_2015_old)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.2589 | 0.1483 | -1.745 | -0.5497 | 0.03184 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.05817 | 0.01424 | 4.085 | 0.03026 | 0.08608 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.001978 | 0.0004199 | -4.709 | -0.002801 | -0.001155 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00001287 | 0.000003875 | 3.32 | 0.00000527 | 0.00002046 | fixed |
| male | 0.1522 | 0.01535 | 9.916 | 0.1221 | 0.1823 | fixed |
| sibling_count3 | 0.03526 | 0.0328 | 1.075 | -0.02903 | 0.09955 | fixed |
| sibling_count4 | -0.001169 | 0.03399 | -0.03439 | -0.06778 | 0.06545 | fixed |
| sibling_count5 | 0.03681 | 0.03559 | 1.034 | -0.03294 | 0.1066 | fixed |
| sibling_count5+ | -0.1097 | 0.02774 | -3.955 | -0.1641 | -0.05535 | fixed |
| sd_(Intercept).mother_pidlink | 0.4621 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8175 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.2593 | 0.1483 | -1.748 | -0.5501 | 0.0314 | fixed |
| birth_order | -0.006107 | 0.003326 | -1.836 | -0.01263 | 0.0004111 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.06006 | 0.01428 | 4.207 | 0.03208 | 0.08804 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002051 | 0.0004218 | -4.862 | -0.002877 | -0.001224 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00001355 | 0.000003893 | 3.482 | 0.000005924 | 0.00002118 | fixed |
| male | 0.1523 | 0.01535 | 9.924 | 0.1222 | 0.1824 | fixed |
| sibling_count3 | 0.03641 | 0.0328 | 1.11 | -0.02788 | 0.1007 | fixed |
| sibling_count4 | 0.00274 | 0.03404 | 0.0805 | -0.06398 | 0.06946 | fixed |
| sibling_count5 | 0.04392 | 0.03578 | 1.227 | -0.02622 | 0.114 | fixed |
| sibling_count5+ | -0.08692 | 0.03038 | -2.861 | -0.1465 | -0.02738 | fixed |
| sd_(Intercept).mother_pidlink | 0.4614 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8177 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.2533 | 0.1487 | -1.703 | -0.5447 | 0.03815 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.05911 | 0.01428 | 4.14 | 0.03113 | 0.08709 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002023 | 0.0004217 | -4.798 | -0.00285 | -0.001197 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00001335 | 0.000003894 | 3.429 | 0.000005722 | 0.00002099 | fixed |
| male | 0.1521 | 0.01535 | 9.913 | 0.122 | 0.1822 | fixed |
| sibling_count3 | 0.02663 | 0.03319 | 0.8024 | -0.03841 | 0.09167 | fixed |
| sibling_count4 | -0.00795 | 0.03484 | -0.2282 | -0.07624 | 0.06034 | fixed |
| sibling_count5 | 0.02496 | 0.03693 | 0.6759 | -0.04742 | 0.09734 | fixed |
| sibling_count5+ | -0.1004 | 0.0317 | -3.166 | -0.1625 | -0.03823 | fixed |
| birth_order_nonlinear2 | -0.01635 | 0.02205 | -0.7413 | -0.05957 | 0.02687 | fixed |
| birth_order_nonlinear3 | 0.03193 | 0.02594 | 1.231 | -0.01891 | 0.08278 | fixed |
| birth_order_nonlinear4 | -0.01247 | 0.02955 | -0.4222 | -0.07039 | 0.04544 | fixed |
| birth_order_nonlinear5 | 0.02924 | 0.03368 | 0.8682 | -0.03677 | 0.09525 | fixed |
| birth_order_nonlinear5+ | -0.04653 | 0.02843 | -1.636 | -0.1023 | 0.009197 | fixed |
| sd_(Intercept).mother_pidlink | 0.4618 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8174 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.23 | 0.1493 | -1.54 | -0.5227 | 0.06267 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.05915 | 0.01428 | 4.142 | 0.03116 | 0.08713 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002015 | 0.0004219 | -4.777 | -0.002842 | -0.001188 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000132 | 0.000003896 | 3.389 | 0.000005569 | 0.00002084 | fixed |
| male | 0.1523 | 0.01535 | 9.921 | 0.1222 | 0.1824 | fixed |
| count_birth_order2/2 | -0.08968 | 0.04298 | -2.087 | -0.1739 | -0.005445 | fixed |
| count_birth_order1/3 | 0.001331 | 0.04216 | 0.03157 | -0.0813 | 0.08396 | fixed |
| count_birth_order2/3 | -0.01655 | 0.04682 | -0.3534 | -0.1083 | 0.07523 | fixed |
| count_birth_order3/3 | 0.02862 | 0.05232 | 0.547 | -0.07393 | 0.1312 | fixed |
| count_birth_order1/4 | -0.05712 | 0.04776 | -1.196 | -0.1507 | 0.03649 | fixed |
| count_birth_order2/4 | -0.00643 | 0.0504 | -0.1276 | -0.1052 | 0.09234 | fixed |
| count_birth_order3/4 | -0.003269 | 0.0545 | -0.05998 | -0.1101 | 0.1035 | fixed |
| count_birth_order4/4 | -0.07443 | 0.05735 | -1.298 | -0.1868 | 0.03796 | fixed |
| count_birth_order1/5 | -0.06156 | 0.05424 | -1.135 | -0.1679 | 0.04474 | fixed |
| count_birth_order2/5 | 0.001736 | 0.05671 | 0.03062 | -0.1094 | 0.1129 | fixed |
| count_birth_order3/5 | 0.04451 | 0.05839 | 0.7622 | -0.06993 | 0.1589 | fixed |
| count_birth_order4/5 | -0.03346 | 0.06165 | -0.5427 | -0.1543 | 0.08738 | fixed |
| count_birth_order5/5 | 0.09651 | 0.06314 | 1.529 | -0.02724 | 0.2203 | fixed |
| count_birth_order1/5+ | -0.1224 | 0.04362 | -2.805 | -0.2078 | -0.03686 | fixed |
| count_birth_order2/5+ | -0.1417 | 0.04493 | -3.153 | -0.2297 | -0.05362 | fixed |
| count_birth_order3/5+ | -0.1007 | 0.04394 | -2.291 | -0.1868 | -0.01454 | fixed |
| count_birth_order4/5+ | -0.1217 | 0.04315 | -2.82 | -0.2063 | -0.03712 | fixed |
| count_birth_order5/5+ | -0.1216 | 0.04345 | -2.798 | -0.2067 | -0.03643 | fixed |
| count_birth_order5+/5+ | -0.174 | 0.0348 | -5 | -0.2422 | -0.1058 | fixed |
| sd_(Intercept).mother_pidlink | 0.4612 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8177 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 37283 | 37366 | -18631 | 37261 | NA | NA | NA |
| 12 | 37282 | 37372 | -18629 | 37258 | 3.375 | 1 | 0.06621 |
| 16 | 37283 | 37404 | -18625 | 37251 | 6.817 | 4 | 0.1459 |
| 26 | 37293 | 37489 | -18621 | 37241 | 9.765 | 10 | 0.4614 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5241 | 0.3667 | -1.429 | -1.243 | 0.1946 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09035 | 0.04162 | 2.171 | 0.008782 | 0.1719 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002746 | 0.001486 | -1.849 | -0.005658 | 0.0001652 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002114 | 0.00001683 | 1.256 | -0.00001185 | 0.00005412 | fixed |
| male | 0.09392 | 0.02139 | 4.392 | 0.052 | 0.1358 | fixed |
| sibling_count3 | 0.0296 | 0.03472 | 0.8526 | -0.03845 | 0.09766 | fixed |
| sibling_count4 | -0.0397 | 0.03752 | -1.058 | -0.1132 | 0.03383 | fixed |
| sibling_count5 | -0.08843 | 0.04313 | -2.05 | -0.173 | -0.003891 | fixed |
| sibling_count5+ | -0.1438 | 0.03792 | -3.792 | -0.2181 | -0.06949 | fixed |
| sd_(Intercept).mother_pidlink | 0.3938 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7424 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5258 | 0.3668 | -1.434 | -1.245 | 0.193 | fixed |
| birth_order | 0.002299 | 0.007146 | 0.3217 | -0.01171 | 0.0163 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09021 | 0.04162 | 2.167 | 0.008632 | 0.1718 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002745 | 0.001486 | -1.848 | -0.005657 | 0.000167 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002121 | 0.00001683 | 1.26 | -0.00001178 | 0.0000542 | fixed |
| male | 0.09381 | 0.02139 | 4.386 | 0.05188 | 0.1357 | fixed |
| sibling_count3 | 0.02845 | 0.03491 | 0.815 | -0.03997 | 0.09687 | fixed |
| sibling_count4 | -0.0424 | 0.03845 | -1.103 | -0.1178 | 0.03297 | fixed |
| sibling_count5 | -0.09284 | 0.04527 | -2.051 | -0.1816 | -0.004117 | fixed |
| sibling_count5+ | -0.1526 | 0.04681 | -3.261 | -0.2444 | -0.06089 | fixed |
| sd_(Intercept).mother_pidlink | 0.394 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7423 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5665 | 0.3675 | -1.541 | -1.287 | 0.1539 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09346 | 0.04166 | 2.243 | 0.01181 | 0.1751 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00286 | 0.001487 | -1.923 | -0.005774 | 0.00005512 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002249 | 0.00001685 | 1.335 | -0.00001053 | 0.00005552 | fixed |
| male | 0.09389 | 0.02139 | 4.389 | 0.05196 | 0.1358 | fixed |
| sibling_count3 | 0.01664 | 0.03555 | 0.468 | -0.05304 | 0.08633 | fixed |
| sibling_count4 | -0.05847 | 0.03981 | -1.469 | -0.1365 | 0.01957 | fixed |
| sibling_count5 | -0.1133 | 0.04732 | -2.394 | -0.2061 | -0.02056 | fixed |
| sibling_count5+ | -0.1617 | 0.04806 | -3.365 | -0.2559 | -0.06754 | fixed |
| birth_order_nonlinear2 | 0.04528 | 0.02729 | 1.659 | -0.008212 | 0.09877 | fixed |
| birth_order_nonlinear3 | 0.0584 | 0.03378 | 1.729 | -0.007813 | 0.1246 | fixed |
| birth_order_nonlinear4 | 0.03984 | 0.04188 | 0.9514 | -0.04224 | 0.1219 | fixed |
| birth_order_nonlinear5 | 0.05613 | 0.05225 | 1.074 | -0.04627 | 0.1585 | fixed |
| birth_order_nonlinear5+ | 0.01605 | 0.05306 | 0.3025 | -0.08795 | 0.12 | fixed |
| sd_(Intercept).mother_pidlink | 0.3928 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7428 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5931 | 0.3685 | -1.61 | -1.315 | 0.1291 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09665 | 0.04176 | 2.314 | 0.0148 | 0.1785 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002961 | 0.001491 | -1.986 | -0.005883 | -0.00003867 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002349 | 0.0000169 | 1.39 | -0.000009634 | 0.00005661 | fixed |
| male | 0.09428 | 0.02141 | 4.403 | 0.05231 | 0.1363 | fixed |
| count_birth_order2/2 | 0.03312 | 0.04956 | 0.6683 | -0.06401 | 0.1302 | fixed |
| count_birth_order1/3 | -0.01387 | 0.04484 | -0.3094 | -0.1018 | 0.07402 | fixed |
| count_birth_order2/3 | 0.08776 | 0.04873 | 1.801 | -0.007741 | 0.1833 | fixed |
| count_birth_order3/3 | 0.08144 | 0.0544 | 1.497 | -0.02519 | 0.1881 | fixed |
| count_birth_order1/4 | -0.06891 | 0.05445 | -1.265 | -0.1756 | 0.03781 | fixed |
| count_birth_order2/4 | -0.02435 | 0.05634 | -0.4322 | -0.1348 | 0.08608 | fixed |
| count_birth_order3/4 | 0.006464 | 0.05937 | 0.1089 | -0.1099 | 0.1228 | fixed |
| count_birth_order4/4 | -0.0157 | 0.06178 | -0.2541 | -0.1368 | 0.1054 | fixed |
| count_birth_order1/5 | -0.05962 | 0.07384 | -0.8075 | -0.2043 | 0.0851 | fixed |
| count_birth_order2/5 | -0.04247 | 0.07901 | -0.5376 | -0.1973 | 0.1124 | fixed |
| count_birth_order3/5 | -0.05223 | 0.07429 | -0.703 | -0.1978 | 0.09337 | fixed |
| count_birth_order4/5 | -0.1066 | 0.07177 | -1.486 | -0.2473 | 0.03402 | fixed |
| count_birth_order5/5 | -0.1237 | 0.07425 | -1.666 | -0.2692 | 0.02181 | fixed |
| count_birth_order1/5+ | -0.1206 | 0.07347 | -1.642 | -0.2646 | 0.02337 | fixed |
| count_birth_order2/5+ | -0.1956 | 0.07265 | -2.693 | -0.338 | -0.05325 | fixed |
| count_birth_order3/5+ | -0.1502 | 0.07269 | -2.066 | -0.2926 | -0.007687 | fixed |
| count_birth_order4/5+ | -0.1115 | 0.06833 | -1.631 | -0.2454 | 0.02246 | fixed |
| count_birth_order5/5+ | -0.06799 | 0.06468 | -1.051 | -0.1948 | 0.05878 | fixed |
| count_birth_order5+/5+ | -0.1493 | 0.0495 | -3.016 | -0.2463 | -0.05226 | fixed |
| sd_(Intercept).mother_pidlink | 0.3924 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7433 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 14652 | 14726 | -7315 | 14630 | NA | NA | NA |
| 12 | 14654 | 14734 | -7315 | 14630 | 0.1023 | 1 | 0.7491 |
| 16 | 14657 | 14764 | -7313 | 14625 | 4.598 | 4 | 0.3311 |
| 26 | 14671 | 14844 | -7309 | 14619 | 6.858 | 10 | 0.7388 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.4997 | 0.3654 | -1.367 | -1.216 | 0.2166 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08706 | 0.04149 | 2.098 | 0.005739 | 0.1684 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002669 | 0.001481 | -1.801 | -0.005572 | 0.000235 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000203 | 0.00001679 | 1.209 | -0.0000126 | 0.0000532 | fixed |
| male | 0.09351 | 0.02129 | 4.392 | 0.05178 | 0.1352 | fixed |
| sibling_count3 | 0.03147 | 0.0375 | 0.8392 | -0.04204 | 0.105 | fixed |
| sibling_count4 | -0.009716 | 0.03964 | -0.2451 | -0.08741 | 0.06797 | fixed |
| sibling_count5 | -0.01839 | 0.04258 | -0.4318 | -0.1019 | 0.06508 | fixed |
| sibling_count5+ | -0.0805 | 0.03731 | -2.157 | -0.1536 | -0.007369 | fixed |
| sd_(Intercept).mother_pidlink | 0.3954 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7416 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.4938 | 0.3655 | -1.351 | -1.21 | 0.2226 | fixed |
| birth_order | -0.005347 | 0.006257 | -0.8546 | -0.01761 | 0.006915 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08718 | 0.0415 | 2.101 | 0.005853 | 0.1685 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002665 | 0.001482 | -1.799 | -0.005569 | 0.000239 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002004 | 0.00001679 | 1.193 | -0.00001288 | 0.00005295 | fixed |
| male | 0.09375 | 0.0213 | 4.402 | 0.05201 | 0.1355 | fixed |
| sibling_count3 | 0.03414 | 0.03762 | 0.9075 | -0.0396 | 0.1079 | fixed |
| sibling_count4 | -0.003681 | 0.04025 | -0.09145 | -0.08257 | 0.07521 | fixed |
| sibling_count5 | -0.008885 | 0.044 | -0.2019 | -0.09513 | 0.07736 | fixed |
| sibling_count5+ | -0.06066 | 0.04394 | -1.381 | -0.1468 | 0.02546 | fixed |
| sd_(Intercept).mother_pidlink | 0.3946 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7419 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5303 | 0.3662 | -1.448 | -1.248 | 0.1875 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08914 | 0.04153 | 2.146 | 0.00774 | 0.1705 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002734 | 0.001483 | -1.844 | -0.005641 | 0.0001724 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002084 | 0.00001681 | 1.24 | -0.00001211 | 0.00005378 | fixed |
| male | 0.09355 | 0.0213 | 4.391 | 0.05179 | 0.1353 | fixed |
| sibling_count3 | 0.02214 | 0.03824 | 0.579 | -0.05281 | 0.09708 | fixed |
| sibling_count4 | -0.02317 | 0.04153 | -0.558 | -0.1046 | 0.05823 | fixed |
| sibling_count5 | -0.03049 | 0.04591 | -0.6641 | -0.1205 | 0.05949 | fixed |
| sibling_count5+ | -0.07221 | 0.04516 | -1.599 | -0.1607 | 0.0163 | fixed |
| birth_order_nonlinear2 | 0.036 | 0.02783 | 1.294 | -0.01855 | 0.09056 | fixed |
| birth_order_nonlinear3 | 0.04407 | 0.03368 | 1.309 | -0.02194 | 0.1101 | fixed |
| birth_order_nonlinear4 | 0.03472 | 0.04065 | 0.8542 | -0.04494 | 0.1144 | fixed |
| birth_order_nonlinear5 | 0.01614 | 0.04974 | 0.3245 | -0.08135 | 0.1136 | fixed |
| birth_order_nonlinear5+ | -0.03226 | 0.04754 | -0.6786 | -0.1254 | 0.06092 | fixed |
| sd_(Intercept).mother_pidlink | 0.3933 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7425 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.527 | 0.3668 | -1.437 | -1.246 | 0.192 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08859 | 0.04158 | 2.131 | 0.007097 | 0.1701 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002699 | 0.001485 | -1.817 | -0.005609 | 0.0002117 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002026 | 0.00001683 | 1.203 | -0.00001273 | 0.00005325 | fixed |
| male | 0.09351 | 0.0213 | 4.389 | 0.05176 | 0.1353 | fixed |
| count_birth_order2/2 | 0.03047 | 0.05428 | 0.5614 | -0.07591 | 0.1369 | fixed |
| count_birth_order1/3 | -0.005049 | 0.0485 | -0.1041 | -0.1001 | 0.09001 | fixed |
| count_birth_order2/3 | 0.07102 | 0.05237 | 1.356 | -0.03162 | 0.1737 | fixed |
| count_birth_order3/3 | 0.09355 | 0.05888 | 1.589 | -0.02185 | 0.209 | fixed |
| count_birth_order1/4 | -0.07743 | 0.05693 | -1.36 | -0.189 | 0.03414 | fixed |
| count_birth_order2/4 | 0.04346 | 0.05822 | 0.7466 | -0.07064 | 0.1576 | fixed |
| count_birth_order3/4 | 0.04852 | 0.0635 | 0.7642 | -0.07593 | 0.173 | fixed |
| count_birth_order4/4 | 0.01437 | 0.06557 | 0.2191 | -0.1142 | 0.1429 | fixed |
| count_birth_order1/5 | 0.02045 | 0.06753 | 0.3029 | -0.1119 | 0.1528 | fixed |
| count_birth_order2/5 | 0.05005 | 0.07271 | 0.6884 | -0.09246 | 0.1926 | fixed |
| count_birth_order3/5 | -0.02403 | 0.07055 | -0.3406 | -0.1623 | 0.1143 | fixed |
| count_birth_order4/5 | -0.03049 | 0.07305 | -0.4174 | -0.1737 | 0.1127 | fixed |
| count_birth_order5/5 | -0.06213 | 0.07291 | -0.8522 | -0.205 | 0.08076 | fixed |
| count_birth_order1/5+ | 0.008191 | 0.06447 | 0.127 | -0.1182 | 0.1345 | fixed |
| count_birth_order2/5+ | -0.146 | 0.06705 | -2.177 | -0.2774 | -0.01458 | fixed |
| count_birth_order3/5+ | -0.06925 | 0.06562 | -1.055 | -0.1979 | 0.05935 | fixed |
| count_birth_order4/5+ | -0.02285 | 0.06336 | -0.3607 | -0.147 | 0.1013 | fixed |
| count_birth_order5/5+ | -0.02685 | 0.06489 | -0.4137 | -0.154 | 0.1003 | fixed |
| count_birth_order5+/5+ | -0.1068 | 0.04849 | -2.204 | -0.2019 | -0.01182 | fixed |
| sd_(Intercept).mother_pidlink | 0.3949 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7416 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 14783 | 14856 | -7380 | 14761 | NA | NA | NA |
| 12 | 14784 | 14864 | -7380 | 14760 | 0.7334 | 1 | 0.3918 |
| 16 | 14788 | 14895 | -7378 | 14756 | 3.844 | 4 | 0.4275 |
| 26 | 14795 | 14969 | -7371 | 14743 | 13.4 | 10 | 0.202 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5761 | 0.3711 | -1.552 | -1.303 | 0.1513 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09716 | 0.04213 | 2.306 | 0.01458 | 0.1797 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003018 | 0.001504 | -2.006 | -0.005966 | -0.00006911 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002451 | 0.00001705 | 1.437 | -0.000008914 | 0.00005793 | fixed |
| male | 0.09125 | 0.02161 | 4.222 | 0.04889 | 0.1336 | fixed |
| sibling_count3 | 0.01999 | 0.03422 | 0.5842 | -0.04708 | 0.08707 | fixed |
| sibling_count4 | -0.03413 | 0.03724 | -0.9165 | -0.1071 | 0.03886 | fixed |
| sibling_count5 | -0.08933 | 0.0442 | -2.021 | -0.176 | -0.002698 | fixed |
| sibling_count5+ | -0.1448 | 0.03831 | -3.779 | -0.2199 | -0.06971 | fixed |
| sd_(Intercept).mother_pidlink | 0.3902 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7437 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5775 | 0.3712 | -1.556 | -1.305 | 0.1499 | fixed |
| birth_order | 0.002238 | 0.007356 | 0.3042 | -0.01218 | 0.01666 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.097 | 0.04214 | 2.302 | 0.01441 | 0.1796 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003016 | 0.001505 | -2.004 | -0.005964 | -0.00006674 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002458 | 0.00001706 | 1.441 | -0.00000885 | 0.00005801 | fixed |
| male | 0.09118 | 0.02162 | 4.218 | 0.04882 | 0.1336 | fixed |
| sibling_count3 | 0.01887 | 0.03442 | 0.5481 | -0.0486 | 0.08634 | fixed |
| sibling_count4 | -0.03673 | 0.03821 | -0.9612 | -0.1116 | 0.03816 | fixed |
| sibling_count5 | -0.09345 | 0.04623 | -2.022 | -0.184 | -0.002845 | fixed |
| sibling_count5+ | -0.1533 | 0.04742 | -3.233 | -0.2462 | -0.06036 | fixed |
| sd_(Intercept).mother_pidlink | 0.3905 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7437 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.6256 | 0.3718 | -1.683 | -1.354 | 0.1032 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1004 | 0.04217 | 2.382 | 0.0178 | 0.1831 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003136 | 0.001506 | -2.083 | -0.006087 | -0.000185 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002589 | 0.00001707 | 1.517 | -0.000007558 | 0.00005935 | fixed |
| male | 0.0914 | 0.02162 | 4.228 | 0.04903 | 0.1338 | fixed |
| sibling_count3 | 0.008164 | 0.03508 | 0.2327 | -0.06059 | 0.07692 | fixed |
| sibling_count4 | -0.05403 | 0.03961 | -1.364 | -0.1317 | 0.02361 | fixed |
| sibling_count5 | -0.1078 | 0.04814 | -2.239 | -0.2021 | -0.01343 | fixed |
| sibling_count5+ | -0.1591 | 0.04873 | -3.265 | -0.2546 | -0.0636 | fixed |
| birth_order_nonlinear2 | 0.06079 | 0.02726 | 2.23 | 0.007365 | 0.1142 | fixed |
| birth_order_nonlinear3 | 0.05707 | 0.03379 | 1.689 | -0.00916 | 0.1233 | fixed |
| birth_order_nonlinear4 | 0.05315 | 0.04308 | 1.234 | -0.03129 | 0.1376 | fixed |
| birth_order_nonlinear5 | 0.02966 | 0.05454 | 0.5438 | -0.07724 | 0.1366 | fixed |
| birth_order_nonlinear5+ | 0.02338 | 0.05469 | 0.4275 | -0.08381 | 0.1306 | fixed |
| sd_(Intercept).mother_pidlink | 0.3892 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7441 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.6437 | 0.3729 | -1.726 | -1.375 | 0.08717 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1026 | 0.04228 | 2.427 | 0.01973 | 0.1855 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003204 | 0.00151 | -2.122 | -0.006164 | -0.0002446 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002657 | 0.00001712 | 1.552 | -0.000006992 | 0.00006013 | fixed |
| male | 0.09147 | 0.02164 | 4.227 | 0.04905 | 0.1339 | fixed |
| count_birth_order2/2 | 0.05327 | 0.04822 | 1.105 | -0.04123 | 0.1478 | fixed |
| count_birth_order1/3 | -0.01454 | 0.04425 | -0.3286 | -0.1013 | 0.07219 | fixed |
| count_birth_order2/3 | 0.09972 | 0.04866 | 2.049 | 0.004357 | 0.1951 | fixed |
| count_birth_order3/3 | 0.05742 | 0.05341 | 1.075 | -0.04726 | 0.1621 | fixed |
| count_birth_order1/4 | -0.0668 | 0.05467 | -1.222 | -0.174 | 0.04036 | fixed |
| count_birth_order2/4 | -0.003471 | 0.05641 | -0.06154 | -0.114 | 0.1071 | fixed |
| count_birth_order3/4 | 0.0155 | 0.05882 | 0.2634 | -0.0998 | 0.1308 | fixed |
| count_birth_order4/4 | 0.004197 | 0.06202 | 0.06768 | -0.1174 | 0.1257 | fixed |
| count_birth_order1/5 | -0.05474 | 0.07389 | -0.7408 | -0.1996 | 0.09008 | fixed |
| count_birth_order2/5 | -0.04276 | 0.08163 | -0.5239 | -0.2028 | 0.1172 | fixed |
| count_birth_order3/5 | -0.04845 | 0.07764 | -0.624 | -0.2006 | 0.1037 | fixed |
| count_birth_order4/5 | -0.07973 | 0.07529 | -1.059 | -0.2273 | 0.06784 | fixed |
| count_birth_order5/5 | -0.1367 | 0.07946 | -1.72 | -0.2924 | 0.01905 | fixed |
| count_birth_order1/5+ | -0.1208 | 0.0752 | -1.607 | -0.2682 | 0.02654 | fixed |
| count_birth_order2/5+ | -0.1781 | 0.07448 | -2.391 | -0.3241 | -0.03211 | fixed |
| count_birth_order3/5+ | -0.1208 | 0.07353 | -1.643 | -0.2649 | 0.02331 | fixed |
| count_birth_order4/5+ | -0.1009 | 0.07186 | -1.404 | -0.2417 | 0.03994 | fixed |
| count_birth_order5/5+ | -0.09842 | 0.06622 | -1.486 | -0.2282 | 0.03136 | fixed |
| count_birth_order5+/5+ | -0.1381 | 0.0504 | -2.74 | -0.2369 | -0.03932 | fixed |
| sd_(Intercept).mother_pidlink | 0.3886 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7447 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 14356 | 14429 | -7167 | 14334 | NA | NA | NA |
| 12 | 14358 | 14438 | -7167 | 14334 | 0.09157 | 1 | 0.7622 |
| 16 | 14360 | 14467 | -7164 | 14328 | 6.1 | 4 | 0.1918 |
| 26 | 14375 | 14548 | -7161 | 14323 | 5.282 | 10 | 0.8716 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = math_2015_old)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3193 | 0.2143 | 1.49 | -0.1007 | 0.7392 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.007294 | 0.02199 | 0.3316 | -0.03581 | 0.0504 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0005758 | 0.0007025 | -0.8196 | -0.001953 | 0.0008011 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000004245 | 0.000007055 | 0.6017 | -0.000009582 | 0.00001807 | fixed |
| male | -0.07804 | 0.01633 | -4.778 | -0.11 | -0.04602 | fixed |
| sibling_count3 | 0.03562 | 0.03434 | 1.037 | -0.03169 | 0.1029 | fixed |
| sibling_count4 | -0.04503 | 0.03547 | -1.27 | -0.1145 | 0.02448 | fixed |
| sibling_count5 | -0.01284 | 0.03704 | -0.3466 | -0.08544 | 0.05976 | fixed |
| sibling_count5+ | -0.1715 | 0.02895 | -5.922 | -0.2282 | -0.1147 | fixed |
| sd_(Intercept).mother_pidlink | 0.4447 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.881 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3021 | 0.2145 | 1.409 | -0.1182 | 0.7225 | fixed |
| birth_order | -0.006092 | 0.003514 | -1.734 | -0.01298 | 0.0007958 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01092 | 0.02209 | 0.4941 | -0.03238 | 0.05422 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0007057 | 0.0007065 | -0.9988 | -0.00209 | 0.0006791 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000005524 | 0.000007093 | 0.7787 | -0.000008379 | 0.00001943 | fixed |
| male | -0.07783 | 0.01633 | -4.765 | -0.1098 | -0.04582 | fixed |
| sibling_count3 | 0.03689 | 0.03434 | 1.074 | -0.03042 | 0.1042 | fixed |
| sibling_count4 | -0.04087 | 0.03554 | -1.15 | -0.1105 | 0.02879 | fixed |
| sibling_count5 | -0.005543 | 0.03727 | -0.1487 | -0.07859 | 0.0675 | fixed |
| sibling_count5+ | -0.1485 | 0.03184 | -4.664 | -0.2109 | -0.08609 | fixed |
| sd_(Intercept).mother_pidlink | 0.4442 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8811 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3361 | 0.2158 | 1.558 | -0.0868 | 0.7591 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.006561 | 0.02214 | 0.2963 | -0.03683 | 0.04995 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0005546 | 0.0007086 | -0.7827 | -0.001943 | 0.0008343 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000004035 | 0.000007122 | 0.5665 | -0.000009925 | 0.000018 | fixed |
| male | -0.0781 | 0.01634 | -4.781 | -0.1101 | -0.04609 | fixed |
| sibling_count3 | 0.03465 | 0.03477 | 0.9965 | -0.0335 | 0.1028 | fixed |
| sibling_count4 | -0.05003 | 0.03642 | -1.374 | -0.1214 | 0.02136 | fixed |
| sibling_count5 | -0.02144 | 0.03854 | -0.5564 | -0.09697 | 0.05409 | fixed |
| sibling_count5+ | -0.1731 | 0.03329 | -5.201 | -0.2384 | -0.1079 | fixed |
| birth_order_nonlinear2 | -0.02299 | 0.02364 | -0.9727 | -0.06933 | 0.02334 | fixed |
| birth_order_nonlinear3 | -0.002078 | 0.02775 | -0.07488 | -0.05647 | 0.05232 | fixed |
| birth_order_nonlinear4 | 0.01697 | 0.03155 | 0.5378 | -0.04487 | 0.07881 | fixed |
| birth_order_nonlinear5 | 0.01641 | 0.03594 | 0.4564 | -0.05404 | 0.08685 | fixed |
| birth_order_nonlinear5+ | -0.01964 | 0.03019 | -0.6505 | -0.0788 | 0.03953 | fixed |
| sd_(Intercept).mother_pidlink | 0.4443 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8812 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3273 | 0.217 | 1.509 | -0.09794 | 0.7526 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.006943 | 0.02219 | 0.3129 | -0.03654 | 0.05043 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0005669 | 0.0007105 | -0.7979 | -0.00196 | 0.0008257 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000004164 | 0.000007146 | 0.5828 | -0.000009841 | 0.00001817 | fixed |
| male | -0.07788 | 0.01634 | -4.766 | -0.1099 | -0.04585 | fixed |
| count_birth_order2/2 | -0.00982 | 0.04618 | -0.2127 | -0.1003 | 0.08068 | fixed |
| count_birth_order1/3 | 0.05031 | 0.04467 | 1.126 | -0.03724 | 0.1379 | fixed |
| count_birth_order2/3 | 0.01198 | 0.04969 | 0.2411 | -0.08541 | 0.1094 | fixed |
| count_birth_order3/3 | 0.0213 | 0.05561 | 0.3831 | -0.08768 | 0.1303 | fixed |
| count_birth_order1/4 | -0.05016 | 0.05062 | -0.9909 | -0.1494 | 0.04906 | fixed |
| count_birth_order2/4 | -0.06037 | 0.05338 | -1.131 | -0.165 | 0.04425 | fixed |
| count_birth_order3/4 | -0.03141 | 0.05772 | -0.5442 | -0.1445 | 0.08172 | fixed |
| count_birth_order4/4 | -0.04884 | 0.06074 | -0.8041 | -0.1679 | 0.0702 | fixed |
| count_birth_order1/5 | -0.05318 | 0.05742 | -0.9263 | -0.1657 | 0.05935 | fixed |
| count_birth_order2/5 | -0.08221 | 0.06012 | -1.367 | -0.2 | 0.03562 | fixed |
| count_birth_order3/5 | 0.01386 | 0.06183 | 0.2241 | -0.1073 | 0.1351 | fixed |
| count_birth_order4/5 | 0.01906 | 0.06531 | 0.2918 | -0.1089 | 0.1471 | fixed |
| count_birth_order5/5 | 0.05706 | 0.06688 | 0.8531 | -0.07403 | 0.1881 | fixed |
| count_birth_order1/5+ | -0.1509 | 0.04641 | -3.251 | -0.2418 | -0.05991 | fixed |
| count_birth_order2/5+ | -0.1789 | 0.04772 | -3.75 | -0.2725 | -0.08542 | fixed |
| count_birth_order3/5+ | -0.183 | 0.04667 | -3.921 | -0.2744 | -0.09152 | fixed |
| count_birth_order4/5+ | -0.1483 | 0.04581 | -3.238 | -0.2381 | -0.05853 | fixed |
| count_birth_order5/5+ | -0.1708 | 0.04611 | -3.705 | -0.2612 | -0.08044 | fixed |
| count_birth_order5+/5+ | -0.1879 | 0.03668 | -5.123 | -0.2598 | -0.116 | fixed |
| sd_(Intercept).mother_pidlink | 0.444 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8815 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 38695 | 38778 | -19337 | 38673 | NA | NA | NA |
| 12 | 38694 | 38785 | -19335 | 38670 | 3.008 | 1 | 0.08286 |
| 16 | 38702 | 38823 | -19335 | 38670 | 0.06628 | 4 | 0.9995 |
| 26 | 38718 | 38914 | -19333 | 38666 | 4.383 | 10 | 0.9284 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.4124 | 0.4482 | -0.92 | -1.291 | 0.4662 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09996 | 0.05087 | 1.965 | 0.0002534 | 0.1997 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003619 | 0.001816 | -1.993 | -0.007178 | -0.00005981 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003836 | 0.00002057 | 1.865 | -0.000001958 | 0.00007868 | fixed |
| male | -0.1536 | 0.02616 | -5.869 | -0.2048 | -0.1023 | fixed |
| sibling_count3 | 0.01062 | 0.04193 | 0.2533 | -0.07156 | 0.0928 | fixed |
| sibling_count4 | -0.08796 | 0.04522 | -1.945 | -0.1766 | 0.0006691 | fixed |
| sibling_count5 | -0.1347 | 0.05191 | -2.594 | -0.2364 | -0.03293 | fixed |
| sibling_count5+ | -0.2428 | 0.04561 | -5.325 | -0.3322 | -0.1534 | fixed |
| sd_(Intercept).mother_pidlink | 0.4377 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.923 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.4249 | 0.4482 | -0.9481 | -1.303 | 0.4535 | fixed |
| birth_order | 0.01582 | 0.008711 | 1.817 | -0.001249 | 0.0329 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09906 | 0.05086 | 1.948 | -0.0006253 | 0.1988 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003611 | 0.001816 | -1.989 | -0.007169 | -0.00005259 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003891 | 0.00002057 | 1.892 | -0.000001407 | 0.00007922 | fixed |
| male | -0.1543 | 0.02616 | -5.898 | -0.2056 | -0.103 | fixed |
| sibling_count3 | 0.002788 | 0.04214 | 0.06616 | -0.07981 | 0.08539 | fixed |
| sibling_count4 | -0.1064 | 0.04634 | -2.296 | -0.1972 | -0.01558 | fixed |
| sibling_count5 | -0.1648 | 0.05449 | -3.024 | -0.2716 | -0.05801 | fixed |
| sibling_count5+ | -0.3032 | 0.05643 | -5.374 | -0.4138 | -0.1926 | fixed |
| sd_(Intercept).mother_pidlink | 0.4378 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9227 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.4289 | 0.4491 | -0.955 | -1.309 | 0.4513 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1012 | 0.05091 | 1.987 | 0.001384 | 0.2009 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003688 | 0.001817 | -2.029 | -0.00725 | -0.0001261 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003982 | 0.00002059 | 1.934 | -0.0000005415 | 0.00008018 | fixed |
| male | -0.1543 | 0.02617 | -5.895 | -0.2055 | -0.103 | fixed |
| sibling_count3 | -0.006667 | 0.04296 | -0.1552 | -0.09088 | 0.07754 | fixed |
| sibling_count4 | -0.1178 | 0.04805 | -2.451 | -0.212 | -0.02361 | fixed |
| sibling_count5 | -0.1912 | 0.05708 | -3.35 | -0.3031 | -0.07933 | fixed |
| sibling_count5+ | -0.317 | 0.058 | -5.465 | -0.4306 | -0.2033 | fixed |
| birth_order_nonlinear2 | 0.02081 | 0.03354 | 0.6204 | -0.04493 | 0.08655 | fixed |
| birth_order_nonlinear3 | 0.07339 | 0.04148 | 1.769 | -0.007901 | 0.1547 | fixed |
| birth_order_nonlinear4 | 0.05819 | 0.05138 | 1.132 | -0.04251 | 0.1589 | fixed |
| birth_order_nonlinear5 | 0.1455 | 0.06415 | 2.269 | 0.01979 | 0.2713 | fixed |
| birth_order_nonlinear5+ | 0.09315 | 0.06484 | 1.437 | -0.03393 | 0.2202 | fixed |
| sd_(Intercept).mother_pidlink | 0.4367 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9232 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.4642 | 0.4503 | -1.031 | -1.347 | 0.4183 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1045 | 0.05104 | 2.048 | 0.004513 | 0.2046 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003813 | 0.001822 | -2.093 | -0.007384 | -0.0002416 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004129 | 0.00002065 | 1.999 | 0.0000008111 | 0.00008176 | fixed |
| male | -0.1531 | 0.0262 | -5.845 | -0.2044 | -0.1018 | fixed |
| count_birth_order2/2 | 0.03911 | 0.06081 | 0.6432 | -0.08008 | 0.1583 | fixed |
| count_birth_order1/3 | 0.004539 | 0.0546 | 0.08314 | -0.1025 | 0.1115 | fixed |
| count_birth_order2/3 | 0.02779 | 0.05938 | 0.4679 | -0.0886 | 0.1442 | fixed |
| count_birth_order3/3 | 0.05161 | 0.06635 | 0.7778 | -0.07844 | 0.1816 | fixed |
| count_birth_order1/4 | -0.1031 | 0.06635 | -1.553 | -0.2331 | 0.02698 | fixed |
| count_birth_order2/4 | -0.131 | 0.06871 | -1.907 | -0.2657 | 0.003622 | fixed |
| count_birth_order3/4 | -0.03292 | 0.07245 | -0.4543 | -0.1749 | 0.1091 | fixed |
| count_birth_order4/4 | -0.02071 | 0.0754 | -0.2747 | -0.1685 | 0.1271 | fixed |
| count_birth_order1/5 | -0.1396 | 0.09008 | -1.55 | -0.3162 | 0.03694 | fixed |
| count_birth_order2/5 | -0.1104 | 0.0965 | -1.144 | -0.2995 | 0.07874 | fixed |
| count_birth_order3/5 | -0.06116 | 0.09072 | -0.6741 | -0.239 | 0.1167 | fixed |
| count_birth_order4/5 | -0.2161 | 0.08761 | -2.466 | -0.3878 | -0.04436 | fixed |
| count_birth_order5/5 | -0.08756 | 0.09067 | -0.9657 | -0.2653 | 0.09014 | fixed |
| count_birth_order1/5+ | -0.3657 | 0.08971 | -4.076 | -0.5415 | -0.1899 | fixed |
| count_birth_order2/5+ | -0.3071 | 0.08873 | -3.461 | -0.481 | -0.1332 | fixed |
| count_birth_order3/5+ | -0.2507 | 0.08883 | -2.822 | -0.4248 | -0.07655 | fixed |
| count_birth_order4/5+ | -0.2177 | 0.0835 | -2.607 | -0.3813 | -0.05401 | fixed |
| count_birth_order5/5+ | -0.1333 | 0.07903 | -1.687 | -0.2882 | 0.02158 | fixed |
| count_birth_order5+/5+ | -0.2173 | 0.06012 | -3.614 | -0.3351 | -0.09944 | fixed |
| sd_(Intercept).mother_pidlink | 0.4363 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9239 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 17008 | 17082 | -8493 | 16986 | NA | NA | NA |
| 12 | 17007 | 17087 | -8492 | 16983 | 3.304 | 1 | 0.06913 |
| 16 | 17012 | 17119 | -8490 | 16980 | 3.482 | 4 | 0.4806 |
| 26 | 17027 | 17200 | -8487 | 16975 | 4.996 | 10 | 0.8914 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.3743 | 0.4477 | -0.8361 | -1.252 | 0.5032 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09573 | 0.05083 | 1.883 | -0.003898 | 0.1954 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003491 | 0.001815 | -1.924 | -0.007049 | 0.00006595 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003683 | 0.00002057 | 1.791 | -0.000003482 | 0.00007714 | fixed |
| male | -0.1544 | 0.02611 | -5.913 | -0.2056 | -0.1032 | fixed |
| sibling_count3 | 0.02706 | 0.04542 | 0.5958 | -0.06196 | 0.1161 | fixed |
| sibling_count4 | -0.07306 | 0.04794 | -1.524 | -0.167 | 0.0209 | fixed |
| sibling_count5 | -0.08228 | 0.05143 | -1.6 | -0.1831 | 0.01851 | fixed |
| sibling_count5+ | -0.1821 | 0.04509 | -4.039 | -0.2705 | -0.09372 | fixed |
| sd_(Intercept).mother_pidlink | 0.4413 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.924 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.3791 | 0.4478 | -0.8465 | -1.257 | 0.4986 | fixed |
| birth_order | 0.004275 | 0.007636 | 0.5599 | -0.01069 | 0.01924 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09565 | 0.05084 | 1.882 | -0.003984 | 0.1953 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003495 | 0.001815 | -1.926 | -0.007052 | 0.00006254 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003704 | 0.00002057 | 1.801 | -0.000003279 | 0.00007736 | fixed |
| male | -0.1546 | 0.02611 | -5.919 | -0.2057 | -0.1034 | fixed |
| sibling_count3 | 0.02495 | 0.04558 | 0.5475 | -0.06438 | 0.1143 | fixed |
| sibling_count4 | -0.07783 | 0.04869 | -1.598 | -0.1733 | 0.0176 | fixed |
| sibling_count5 | -0.08982 | 0.05317 | -1.689 | -0.194 | 0.01438 | fixed |
| sibling_count5+ | -0.1979 | 0.05319 | -3.721 | -0.3021 | -0.09364 | fixed |
| sd_(Intercept).mother_pidlink | 0.4415 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.924 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.3883 | 0.4486 | -0.8654 | -1.268 | 0.491 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09661 | 0.05088 | 1.899 | -0.003112 | 0.1963 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003535 | 0.001817 | -1.946 | -0.007096 | 0.00002593 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003765 | 0.00002059 | 1.828 | -0.000002709 | 0.00007801 | fixed |
| male | -0.1548 | 0.02612 | -5.928 | -0.206 | -0.1036 | fixed |
| sibling_count3 | 0.01383 | 0.04637 | 0.2983 | -0.07706 | 0.1047 | fixed |
| sibling_count4 | -0.09552 | 0.05032 | -1.898 | -0.1942 | 0.003102 | fixed |
| sibling_count5 | -0.1103 | 0.05558 | -1.984 | -0.2192 | -0.001355 | fixed |
| sibling_count5+ | -0.2216 | 0.05474 | -4.048 | -0.3289 | -0.1143 | fixed |
| birth_order_nonlinear2 | 0.02009 | 0.03426 | 0.5864 | -0.04706 | 0.08725 | fixed |
| birth_order_nonlinear3 | 0.05782 | 0.04142 | 1.396 | -0.02337 | 0.139 | fixed |
| birth_order_nonlinear4 | 0.05083 | 0.04996 | 1.018 | -0.04708 | 0.1488 | fixed |
| birth_order_nonlinear5 | 0.0438 | 0.06117 | 0.716 | -0.07609 | 0.1637 | fixed |
| birth_order_nonlinear5+ | 0.05985 | 0.05819 | 1.029 | -0.05419 | 0.1739 | fixed |
| sd_(Intercept).mother_pidlink | 0.4413 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9242 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.4364 | 0.4495 | -0.9708 | -1.317 | 0.4447 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1003 | 0.05096 | 1.969 | 0.0004537 | 0.2002 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003676 | 0.00182 | -2.02 | -0.007243 | -0.0001092 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003931 | 0.00002063 | 1.906 | -0.000001122 | 0.00007975 | fixed |
| male | -0.1557 | 0.02614 | -5.956 | -0.2069 | -0.1044 | fixed |
| count_birth_order2/2 | 0.07481 | 0.06677 | 1.12 | -0.05605 | 0.2057 | fixed |
| count_birth_order1/3 | 0.06574 | 0.05921 | 1.11 | -0.05032 | 0.1818 | fixed |
| count_birth_order2/3 | 0.007638 | 0.06399 | 0.1194 | -0.1178 | 0.1331 | fixed |
| count_birth_order3/3 | 0.08768 | 0.07201 | 1.218 | -0.05346 | 0.2288 | fixed |
| count_birth_order1/4 | -0.1036 | 0.06955 | -1.49 | -0.24 | 0.03269 | fixed |
| count_birth_order2/4 | -0.03628 | 0.07118 | -0.5097 | -0.1758 | 0.1032 | fixed |
| count_birth_order3/4 | -0.02561 | 0.07771 | -0.3295 | -0.1779 | 0.1267 | fixed |
| count_birth_order4/4 | -0.006286 | 0.08024 | -0.07833 | -0.1636 | 0.151 | fixed |
| count_birth_order1/5 | -0.007333 | 0.08258 | -0.0888 | -0.1692 | 0.1545 | fixed |
| count_birth_order2/5 | -0.07043 | 0.08902 | -0.7912 | -0.2449 | 0.104 | fixed |
| count_birth_order3/5 | 0.01048 | 0.08637 | 0.1213 | -0.1588 | 0.1798 | fixed |
| count_birth_order4/5 | -0.1567 | 0.08947 | -1.752 | -0.3321 | 0.01864 | fixed |
| count_birth_order5/5 | -0.09262 | 0.08928 | -1.037 | -0.2676 | 0.08236 | fixed |
| count_birth_order1/5+ | -0.2681 | 0.07886 | -3.399 | -0.4226 | -0.1135 | fixed |
| count_birth_order2/5+ | -0.1808 | 0.0821 | -2.202 | -0.3417 | -0.01989 | fixed |
| count_birth_order3/5+ | -0.1727 | 0.08036 | -2.149 | -0.3302 | -0.0152 | fixed |
| count_birth_order4/5+ | -0.09252 | 0.0776 | -1.192 | -0.2446 | 0.05957 | fixed |
| count_birth_order5/5+ | -0.128 | 0.07952 | -1.61 | -0.2839 | 0.02784 | fixed |
| count_birth_order5+/5+ | -0.1425 | 0.05907 | -2.413 | -0.2583 | -0.02678 | fixed |
| sd_(Intercept).mother_pidlink | 0.4412 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9243 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 17187 | 17261 | -8583 | 17165 | NA | NA | NA |
| 12 | 17189 | 17269 | -8582 | 17165 | 0.3133 | 1 | 0.5757 |
| 16 | 17195 | 17302 | -8581 | 17163 | 2.203 | 4 | 0.6986 |
| 26 | 17205 | 17379 | -8577 | 17153 | 9.439 | 10 | 0.491 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5356 | 0.4544 | -1.179 | -1.426 | 0.355 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1138 | 0.05159 | 2.206 | 0.01271 | 0.215 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.004171 | 0.001842 | -2.264 | -0.007782 | -0.0005606 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004509 | 0.00002088 | 2.16 | 0.000004169 | 0.00008602 | fixed |
| male | -0.1506 | 0.02649 | -5.685 | -0.2025 | -0.09867 | fixed |
| sibling_count3 | 0.01379 | 0.04149 | 0.3323 | -0.06754 | 0.09511 | fixed |
| sibling_count4 | -0.06312 | 0.04509 | -1.4 | -0.1515 | 0.02524 | fixed |
| sibling_count5 | -0.1219 | 0.05343 | -2.282 | -0.2266 | -0.01718 | fixed |
| sibling_count5+ | -0.2157 | 0.04628 | -4.662 | -0.3064 | -0.125 | fixed |
| sd_(Intercept).mother_pidlink | 0.4422 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9234 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5462 | 0.4544 | -1.202 | -1.437 | 0.3443 | fixed |
| birth_order | 0.01591 | 0.008989 | 1.77 | -0.001704 | 0.03353 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1127 | 0.05159 | 2.185 | 0.01163 | 0.2138 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.004158 | 0.001842 | -2.258 | -0.007768 | -0.0005481 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000456 | 0.00002088 | 2.184 | 0.000004674 | 0.00008652 | fixed |
| male | -0.151 | 0.02648 | -5.703 | -0.2029 | -0.09913 | fixed |
| sibling_count3 | 0.005873 | 0.04173 | 0.1408 | -0.07591 | 0.08765 | fixed |
| sibling_count4 | -0.08142 | 0.04625 | -1.76 | -0.1721 | 0.009226 | fixed |
| sibling_count5 | -0.1509 | 0.05588 | -2.701 | -0.2604 | -0.04139 | fixed |
| sibling_count5+ | -0.2759 | 0.0574 | -4.806 | -0.3884 | -0.1634 | fixed |
| sd_(Intercept).mother_pidlink | 0.4423 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9231 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5386 | 0.4552 | -1.183 | -1.431 | 0.3536 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1138 | 0.05163 | 2.205 | 0.01263 | 0.215 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.004199 | 0.001843 | -2.278 | -0.007812 | -0.0005865 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004613 | 0.0000209 | 2.207 | 0.000005169 | 0.00008709 | fixed |
| male | -0.1512 | 0.02649 | -5.709 | -0.2032 | -0.09932 | fixed |
| sibling_count3 | -0.002021 | 0.04257 | -0.04749 | -0.08546 | 0.08141 | fixed |
| sibling_count4 | -0.09644 | 0.04802 | -2.008 | -0.1906 | -0.002312 | fixed |
| sibling_count5 | -0.1759 | 0.0583 | -3.017 | -0.2901 | -0.06163 | fixed |
| sibling_count5+ | -0.2909 | 0.05907 | -4.924 | -0.4067 | -0.1751 | fixed |
| birth_order_nonlinear2 | 0.01337 | 0.03353 | 0.3987 | -0.05235 | 0.07909 | fixed |
| birth_order_nonlinear3 | 0.06506 | 0.04154 | 1.566 | -0.01636 | 0.1465 | fixed |
| birth_order_nonlinear4 | 0.08177 | 0.05293 | 1.545 | -0.02197 | 0.1855 | fixed |
| birth_order_nonlinear5 | 0.1201 | 0.06705 | 1.791 | -0.01132 | 0.2515 | fixed |
| birth_order_nonlinear5+ | 0.09651 | 0.06699 | 1.441 | -0.03479 | 0.2278 | fixed |
| sd_(Intercept).mother_pidlink | 0.4415 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9236 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5806 | 0.4565 | -1.272 | -1.475 | 0.3142 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1187 | 0.05177 | 2.292 | 0.0172 | 0.2201 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.004378 | 0.001849 | -2.368 | -0.008002 | -0.0007549 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004819 | 0.00002096 | 2.299 | 0.000007106 | 0.00008928 | fixed |
| male | -0.15 | 0.02652 | -5.658 | -0.202 | -0.09806 | fixed |
| count_birth_order2/2 | 0.01536 | 0.05925 | 0.2592 | -0.1008 | 0.1315 | fixed |
| count_birth_order1/3 | 0.003387 | 0.05402 | 0.0627 | -0.1025 | 0.1093 | fixed |
| count_birth_order2/3 | 0.008751 | 0.05945 | 0.1472 | -0.1078 | 0.1253 | fixed |
| count_birth_order3/3 | 0.05884 | 0.06529 | 0.9012 | -0.06912 | 0.1868 | fixed |
| count_birth_order1/4 | -0.09925 | 0.06679 | -1.486 | -0.2302 | 0.03165 | fixed |
| count_birth_order2/4 | -0.123 | 0.06896 | -1.783 | -0.2581 | 0.01218 | fixed |
| count_birth_order3/4 | 0.001164 | 0.07194 | 0.01618 | -0.1398 | 0.1422 | fixed |
| count_birth_order4/4 | 0.008341 | 0.07586 | 0.11 | -0.1403 | 0.157 | fixed |
| count_birth_order1/5 | -0.123 | 0.09033 | -1.361 | -0.3 | 0.05408 | fixed |
| count_birth_order2/5 | -0.0875 | 0.0999 | -0.8758 | -0.2833 | 0.1083 | fixed |
| count_birth_order3/5 | -0.0931 | 0.09501 | -0.9799 | -0.2793 | 0.09312 | fixed |
| count_birth_order4/5 | -0.1781 | 0.09211 | -1.934 | -0.3587 | 0.002391 | fixed |
| count_birth_order5/5 | -0.11 | 0.09724 | -1.131 | -0.3006 | 0.08061 | fixed |
| count_birth_order1/5+ | -0.3524 | 0.09201 | -3.83 | -0.5328 | -0.1721 | fixed |
| count_birth_order2/5+ | -0.2463 | 0.09116 | -2.702 | -0.425 | -0.06767 | fixed |
| count_birth_order3/5+ | -0.2817 | 0.09003 | -3.129 | -0.4582 | -0.1053 | fixed |
| count_birth_order4/5+ | -0.1651 | 0.08801 | -1.876 | -0.3376 | 0.007367 | fixed |
| count_birth_order5/5+ | -0.1366 | 0.08107 | -1.685 | -0.2955 | 0.02229 | fixed |
| count_birth_order5+/5+ | -0.1927 | 0.06138 | -3.139 | -0.313 | -0.07237 | fixed |
| sd_(Intercept).mother_pidlink | 0.4406 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9244 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 16690 | 16763 | -8334 | 16668 | NA | NA | NA |
| 12 | 16689 | 16769 | -8332 | 16665 | 3.138 | 1 | 0.07648 |
| 16 | 16695 | 16801 | -8331 | 16663 | 2.443 | 4 | 0.6549 |
| 26 | 16709 | 16882 | -8329 | 16657 | 5.429 | 10 | 0.8607 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = raven_2015_young)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.913 | 0.1161 | -25.09 | -3.141 | -2.686 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4204 | 0.02155 | 19.5 | 0.3781 | 0.4626 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01677 | 0.00125 | -13.41 | -0.01922 | -0.01432 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000206 | 0.00002297 | 8.97 | 0.000161 | 0.0002511 | fixed |
| male | 0.04925 | 0.01654 | 2.977 | 0.01683 | 0.08168 | fixed |
| sibling_count3 | -0.03514 | 0.02866 | -1.226 | -0.09131 | 0.02103 | fixed |
| sibling_count4 | -0.08887 | 0.03214 | -2.765 | -0.1519 | -0.02588 | fixed |
| sibling_count5 | -0.07689 | 0.03636 | -2.115 | -0.1482 | -0.005637 | fixed |
| sibling_count5+ | -0.244 | 0.02882 | -8.467 | -0.3005 | -0.1875 | fixed |
| sd_(Intercept).mother_pidlink | 0.5099 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.786 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.899 | 0.1165 | -24.88 | -3.127 | -2.671 | fixed |
| birth_order | -0.006508 | 0.004435 | -1.467 | -0.0152 | 0.002184 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4199 | 0.02156 | 19.48 | 0.3777 | 0.4622 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01677 | 0.00125 | -13.41 | -0.01922 | -0.01432 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002058 | 0.00002297 | 8.96 | 0.0001608 | 0.0002508 | fixed |
| male | 0.04936 | 0.01654 | 2.984 | 0.01693 | 0.08178 | fixed |
| sibling_count3 | -0.03129 | 0.02878 | -1.087 | -0.08769 | 0.02511 | fixed |
| sibling_count4 | -0.07961 | 0.03275 | -2.431 | -0.1438 | -0.01543 | fixed |
| sibling_count5 | -0.06196 | 0.03775 | -1.641 | -0.1359 | 0.01202 | fixed |
| sibling_count5+ | -0.2073 | 0.03816 | -5.432 | -0.2821 | -0.1325 | fixed |
| sd_(Intercept).mother_pidlink | 0.5097 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7861 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.907 | 0.1177 | -24.7 | -3.137 | -2.676 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4201 | 0.02164 | 19.42 | 0.3777 | 0.4625 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01679 | 0.001252 | -13.41 | -0.01924 | -0.01433 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002063 | 0.00002299 | 8.976 | 0.0001613 | 0.0002514 | fixed |
| male | 0.04912 | 0.01655 | 2.969 | 0.01669 | 0.08155 | fixed |
| sibling_count3 | -0.03626 | 0.02964 | -1.223 | -0.09435 | 0.02184 | fixed |
| sibling_count4 | -0.08243 | 0.03527 | -2.337 | -0.1515 | -0.01331 | fixed |
| sibling_count5 | -0.05136 | 0.04155 | -1.236 | -0.1328 | 0.03007 | fixed |
| sibling_count5+ | -0.1992 | 0.04201 | -4.74 | -0.2815 | -0.1168 | fixed |
| birth_order_nonlinear2 | -0.0004814 | 0.02252 | -0.02137 | -0.04463 | 0.04367 | fixed |
| birth_order_nonlinear3 | 0.007394 | 0.02843 | 0.2601 | -0.04832 | 0.06311 | fixed |
| birth_order_nonlinear4 | -0.02942 | 0.03523 | -0.835 | -0.09847 | 0.03963 | fixed |
| birth_order_nonlinear5 | -0.06717 | 0.04142 | -1.622 | -0.1484 | 0.01401 | fixed |
| birth_order_nonlinear5+ | -0.05048 | 0.03943 | -1.28 | -0.1278 | 0.02681 | fixed |
| sd_(Intercept).mother_pidlink | 0.51 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.786 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.913 | 0.1186 | -24.56 | -3.146 | -2.681 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4217 | 0.02167 | 19.46 | 0.3792 | 0.4642 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01689 | 0.001254 | -13.47 | -0.01934 | -0.01443 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000208 | 0.00002301 | 9.043 | 0.000163 | 0.0002531 | fixed |
| male | 0.04874 | 0.01655 | 2.945 | 0.01631 | 0.08117 | fixed |
| count_birth_order2/2 | -0.004616 | 0.0367 | -0.1258 | -0.07655 | 0.06732 | fixed |
| count_birth_order1/3 | -0.06756 | 0.03753 | -1.8 | -0.1411 | 0.005986 | fixed |
| count_birth_order2/3 | -0.03873 | 0.03826 | -1.012 | -0.1137 | 0.03627 | fixed |
| count_birth_order3/3 | 0.02046 | 0.04332 | 0.4722 | -0.06446 | 0.1054 | fixed |
| count_birth_order1/4 | -0.06759 | 0.05129 | -1.318 | -0.1681 | 0.03294 | fixed |
| count_birth_order2/4 | -0.04354 | 0.04874 | -0.8935 | -0.1391 | 0.05198 | fixed |
| count_birth_order3/4 | -0.1544 | 0.04591 | -3.362 | -0.2444 | -0.06439 | fixed |
| count_birth_order4/4 | -0.07384 | 0.05012 | -1.473 | -0.1721 | 0.02438 | fixed |
| count_birth_order1/5 | 0.0104 | 0.0696 | 0.1495 | -0.126 | 0.1468 | fixed |
| count_birth_order2/5 | -0.08665 | 0.06625 | -1.308 | -0.2165 | 0.0432 | fixed |
| count_birth_order3/5 | -0.01868 | 0.06002 | -0.3112 | -0.1363 | 0.09896 | fixed |
| count_birth_order4/5 | -0.1326 | 0.05643 | -2.35 | -0.2432 | -0.02201 | fixed |
| count_birth_order5/5 | -0.1062 | 0.05597 | -1.897 | -0.2159 | 0.003508 | fixed |
| count_birth_order1/5+ | -0.1548 | 0.0697 | -2.221 | -0.2914 | -0.01816 | fixed |
| count_birth_order2/5+ | -0.2376 | 0.06527 | -3.64 | -0.3655 | -0.1096 | fixed |
| count_birth_order3/5+ | -0.1763 | 0.0581 | -3.035 | -0.2902 | -0.06244 | fixed |
| count_birth_order4/5+ | -0.2312 | 0.05287 | -4.372 | -0.3348 | -0.1275 | fixed |
| count_birth_order5/5+ | -0.2756 | 0.0475 | -5.802 | -0.3687 | -0.1825 | fixed |
| count_birth_order5+/5+ | -0.2508 | 0.03316 | -7.564 | -0.3158 | -0.1858 | fixed |
| sd_(Intercept).mother_pidlink | 0.5098 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7859 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 31548 | 31629 | -15763 | 31526 | NA | NA | NA |
| 12 | 31548 | 31636 | -15762 | 31524 | 2.156 | 1 | 0.142 |
| 16 | 31554 | 31672 | -15761 | 31522 | 2.168 | 4 | 0.705 |
| 26 | 31560 | 31752 | -15754 | 31508 | 14.05 | 10 | 0.1707 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.135 | 0.1776 | -17.65 | -3.483 | -2.787 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4673 | 0.03646 | 12.82 | 0.3958 | 0.5388 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01963 | 0.00231 | -8.494 | -0.02415 | -0.0151 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002649 | 0.0000455 | 5.821 | 0.0001757 | 0.0003541 | fixed |
| male | 0.03061 | 0.01923 | 1.592 | -0.007084 | 0.06831 | fixed |
| sibling_count3 | -0.05946 | 0.02726 | -2.182 | -0.1129 | -0.00604 | fixed |
| sibling_count4 | -0.1194 | 0.03344 | -3.571 | -0.185 | -0.05388 | fixed |
| sibling_count5 | -0.2169 | 0.04292 | -5.054 | -0.301 | -0.1328 | fixed |
| sibling_count5+ | -0.2597 | 0.03991 | -6.508 | -0.338 | -0.1815 | fixed |
| sd_(Intercept).mother_pidlink | 0.4912 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7717 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.103 | 0.1799 | -17.25 | -3.456 | -2.751 | fixed |
| birth_order | -0.009805 | 0.008629 | -1.136 | -0.02672 | 0.007108 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4643 | 0.03656 | 12.7 | 0.3927 | 0.536 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01948 | 0.002314 | -8.417 | -0.02401 | -0.01494 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002623 | 0.00004557 | 5.756 | 0.000173 | 0.0003516 | fixed |
| male | 0.0307 | 0.01923 | 1.596 | -0.006995 | 0.0684 | fixed |
| sibling_count3 | -0.05286 | 0.02786 | -1.897 | -0.1075 | 0.001741 | fixed |
| sibling_count4 | -0.1048 | 0.03583 | -2.924 | -0.175 | -0.03455 | fixed |
| sibling_count5 | -0.1926 | 0.04793 | -4.018 | -0.2865 | -0.09866 | fixed |
| sibling_count5+ | -0.2124 | 0.05769 | -3.682 | -0.3255 | -0.09936 | fixed |
| sd_(Intercept).mother_pidlink | 0.4907 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7719 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.137 | 0.1795 | -17.48 | -3.488 | -2.785 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4676 | 0.03657 | 12.79 | 0.3959 | 0.5393 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01965 | 0.002314 | -8.493 | -0.02419 | -0.01512 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002655 | 0.00004556 | 5.826 | 0.0001761 | 0.0003548 | fixed |
| male | 0.02997 | 0.01924 | 1.558 | -0.007733 | 0.06767 | fixed |
| sibling_count3 | -0.0652 | 0.02908 | -2.242 | -0.1222 | -0.008209 | fixed |
| sibling_count4 | -0.1234 | 0.03863 | -3.194 | -0.1991 | -0.04767 | fixed |
| sibling_count5 | -0.1819 | 0.05257 | -3.459 | -0.2849 | -0.07882 | fixed |
| sibling_count5+ | -0.2346 | 0.06227 | -3.768 | -0.3567 | -0.1126 | fixed |
| birth_order_nonlinear2 | 0.0033 | 0.02304 | 0.1432 | -0.04186 | 0.04846 | fixed |
| birth_order_nonlinear3 | 0.0203 | 0.03226 | 0.6294 | -0.04292 | 0.08353 | fixed |
| birth_order_nonlinear4 | -0.002993 | 0.04418 | -0.06775 | -0.08958 | 0.08359 | fixed |
| birth_order_nonlinear5 | -0.1088 | 0.05943 | -1.831 | -0.2253 | 0.00765 | fixed |
| birth_order_nonlinear5+ | -0.01069 | 0.06881 | -0.1554 | -0.1456 | 0.1242 | fixed |
| sd_(Intercept).mother_pidlink | 0.4915 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7716 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.146 | 0.1802 | -17.46 | -3.499 | -2.793 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4697 | 0.03664 | 12.82 | 0.3979 | 0.5415 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01981 | 0.002319 | -8.545 | -0.02436 | -0.01527 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000269 | 0.00004566 | 5.891 | 0.0001795 | 0.0003585 | fixed |
| male | 0.03042 | 0.01924 | 1.581 | -0.007291 | 0.06813 | fixed |
| count_birth_order2/2 | 0.006774 | 0.03232 | 0.2096 | -0.05657 | 0.07011 | fixed |
| count_birth_order1/3 | -0.08009 | 0.038 | -2.108 | -0.1546 | -0.00561 | fixed |
| count_birth_order2/3 | -0.07185 | 0.03655 | -1.966 | -0.1435 | -0.0002115 | fixed |
| count_birth_order3/3 | -0.01001 | 0.04001 | -0.2501 | -0.08843 | 0.06842 | fixed |
| count_birth_order1/4 | -0.04987 | 0.05992 | -0.8323 | -0.1673 | 0.06757 | fixed |
| count_birth_order2/4 | -0.09864 | 0.05259 | -1.876 | -0.2017 | 0.00444 | fixed |
| count_birth_order3/4 | -0.1871 | 0.05021 | -3.726 | -0.2855 | -0.08867 | fixed |
| count_birth_order4/4 | -0.1056 | 0.04973 | -2.124 | -0.2031 | -0.008146 | fixed |
| count_birth_order1/5 | -0.2007 | 0.1043 | -1.924 | -0.4053 | 0.003786 | fixed |
| count_birth_order2/5 | -0.146 | 0.09299 | -1.57 | -0.3283 | 0.03624 | fixed |
| count_birth_order3/5 | -0.08258 | 0.07873 | -1.049 | -0.2369 | 0.07173 | fixed |
| count_birth_order4/5 | -0.2497 | 0.06518 | -3.83 | -0.3774 | -0.1219 | fixed |
| count_birth_order5/5 | -0.2776 | 0.06325 | -4.388 | -0.4016 | -0.1536 | fixed |
| count_birth_order1/5+ | -0.268 | 0.1333 | -2.01 | -0.5293 | -0.006699 | fixed |
| count_birth_order2/5+ | -0.262 | 0.122 | -2.148 | -0.5011 | -0.02298 | fixed |
| count_birth_order3/5+ | -0.2095 | 0.1009 | -2.077 | -0.4072 | -0.0118 | fixed |
| count_birth_order4/5+ | -0.179 | 0.09054 | -1.977 | -0.3564 | -0.001516 | fixed |
| count_birth_order5/5+ | -0.359 | 0.07278 | -4.933 | -0.5016 | -0.2164 | fixed |
| count_birth_order5+/5+ | -0.244 | 0.04847 | -5.033 | -0.339 | -0.149 | fixed |
| sd_(Intercept).mother_pidlink | 0.4921 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7711 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 22246 | 22323 | -11112 | 22224 | NA | NA | NA |
| 12 | 22246 | 22331 | -11111 | 22222 | 1.293 | 1 | 0.2554 |
| 16 | 22250 | 22363 | -11109 | 22218 | 4.165 | 4 | 0.3842 |
| 26 | 22259 | 22442 | -11103 | 22207 | 11.6 | 10 | 0.3129 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.141 | 0.177 | -17.75 | -3.488 | -2.794 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4677 | 0.03633 | 12.87 | 0.3965 | 0.5389 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01973 | 0.002303 | -8.564 | -0.02424 | -0.01521 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002666 | 0.00004538 | 5.876 | 0.0001777 | 0.0003556 | fixed |
| male | 0.02784 | 0.01915 | 1.454 | -0.009698 | 0.06538 | fixed |
| sibling_count3 | -0.04184 | 0.0286 | -1.463 | -0.09789 | 0.0142 | fixed |
| sibling_count4 | -0.07294 | 0.03364 | -2.168 | -0.1389 | -0.007009 | fixed |
| sibling_count5 | -0.08591 | 0.03944 | -2.178 | -0.1632 | -0.008609 | fixed |
| sibling_count5+ | -0.1944 | 0.03514 | -5.532 | -0.2633 | -0.1255 | fixed |
| sd_(Intercept).mother_pidlink | 0.4946 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7717 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.082 | 0.1787 | -17.25 | -3.432 | -2.732 | fixed |
| birth_order | -0.0174 | 0.007239 | -2.404 | -0.03159 | -0.003213 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4622 | 0.0364 | 12.7 | 0.3908 | 0.5335 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01947 | 0.002306 | -8.443 | -0.02399 | -0.01495 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002621 | 0.00004541 | 5.772 | 0.0001731 | 0.0003511 | fixed |
| male | 0.02841 | 0.01915 | 1.484 | -0.009121 | 0.06595 | fixed |
| sibling_count3 | -0.03073 | 0.02895 | -1.062 | -0.08747 | 0.02601 | fixed |
| sibling_count4 | -0.04801 | 0.03518 | -1.364 | -0.117 | 0.02095 | fixed |
| sibling_count5 | -0.04672 | 0.04264 | -1.096 | -0.1303 | 0.03686 | fixed |
| sibling_count5+ | -0.1149 | 0.04825 | -2.381 | -0.2095 | -0.02034 | fixed |
| sd_(Intercept).mother_pidlink | 0.4935 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.772 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.112 | 0.1786 | -17.42 | -3.462 | -2.762 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4643 | 0.03643 | 12.75 | 0.3929 | 0.5357 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01959 | 0.002306 | -8.495 | -0.02411 | -0.01507 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002645 | 0.00004542 | 5.823 | 0.0001754 | 0.0003535 | fixed |
| male | 0.0276 | 0.01915 | 1.441 | -0.009942 | 0.06514 | fixed |
| sibling_count3 | -0.03796 | 0.0301 | -1.261 | -0.09696 | 0.02103 | fixed |
| sibling_count4 | -0.05896 | 0.03796 | -1.553 | -0.1334 | 0.01543 | fixed |
| sibling_count5 | -0.03642 | 0.0465 | -0.7831 | -0.1276 | 0.05473 | fixed |
| sibling_count5+ | -0.1248 | 0.05121 | -2.436 | -0.2251 | -0.02438 | fixed |
| birth_order_nonlinear2 | -0.01198 | 0.02373 | -0.5048 | -0.05848 | 0.03453 | fixed |
| birth_order_nonlinear3 | -0.00978 | 0.03163 | -0.3092 | -0.07177 | 0.05221 | fixed |
| birth_order_nonlinear4 | -0.03695 | 0.04151 | -0.8903 | -0.1183 | 0.0444 | fixed |
| birth_order_nonlinear5 | -0.132 | 0.05216 | -2.532 | -0.2343 | -0.02981 | fixed |
| birth_order_nonlinear5+ | -0.08421 | 0.05662 | -1.487 | -0.1952 | 0.02676 | fixed |
| sd_(Intercept).mother_pidlink | 0.4944 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7717 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.121 | 0.1796 | -17.38 | -3.473 | -2.769 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.467 | 0.03649 | 12.8 | 0.3955 | 0.5385 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0198 | 0.00231 | -8.57 | -0.02433 | -0.01527 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000269 | 0.00004549 | 5.914 | 0.0001799 | 0.0003582 | fixed |
| male | 0.02854 | 0.01916 | 1.489 | -0.009018 | 0.0661 | fixed |
| count_birth_order2/2 | -0.01543 | 0.03533 | -0.4366 | -0.08468 | 0.05382 | fixed |
| count_birth_order1/3 | -0.06278 | 0.03938 | -1.594 | -0.14 | 0.0144 | fixed |
| count_birth_order2/3 | -0.05192 | 0.03852 | -1.348 | -0.1274 | 0.02357 | fixed |
| count_birth_order3/3 | -0.0183 | 0.04222 | -0.4335 | -0.101 | 0.06445 | fixed |
| count_birth_order1/4 | -0.05623 | 0.05864 | -0.9588 | -0.1712 | 0.05871 | fixed |
| count_birth_order2/4 | -0.0529 | 0.05265 | -1.005 | -0.1561 | 0.0503 | fixed |
| count_birth_order3/4 | -0.1333 | 0.0504 | -2.644 | -0.2321 | -0.03448 | fixed |
| count_birth_order4/4 | -0.05557 | 0.05097 | -1.09 | -0.1555 | 0.04433 | fixed |
| count_birth_order1/5 | 0.07905 | 0.08526 | 0.9271 | -0.08807 | 0.2462 | fixed |
| count_birth_order2/5 | -0.03706 | 0.07632 | -0.4856 | -0.1866 | 0.1125 | fixed |
| count_birth_order3/5 | -0.03526 | 0.06854 | -0.5144 | -0.1696 | 0.09908 | fixed |
| count_birth_order4/5 | -0.1447 | 0.06314 | -2.291 | -0.2684 | -0.02093 | fixed |
| count_birth_order5/5 | -0.1711 | 0.06082 | -2.813 | -0.2903 | -0.05186 | fixed |
| count_birth_order1/5+ | -0.1041 | 0.09126 | -1.14 | -0.2829 | 0.0748 | fixed |
| count_birth_order2/5+ | -0.2198 | 0.1014 | -2.167 | -0.4185 | -0.02104 | fixed |
| count_birth_order3/5+ | -0.1055 | 0.07852 | -1.344 | -0.2594 | 0.04834 | fixed |
| count_birth_order4/5+ | -0.1646 | 0.07207 | -2.283 | -0.3058 | -0.02331 | fixed |
| count_birth_order5/5+ | -0.2587 | 0.06275 | -4.123 | -0.3817 | -0.1357 | fixed |
| count_birth_order5+/5+ | -0.2101 | 0.04393 | -4.782 | -0.2962 | -0.124 | fixed |
| sd_(Intercept).mother_pidlink | 0.4947 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7716 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 22545 | 22623 | -11262 | 22523 | NA | NA | NA |
| 12 | 22542 | 22626 | -11259 | 22518 | 5.783 | 1 | 0.01618 |
| 16 | 22548 | 22661 | -11258 | 22516 | 1.276 | 4 | 0.8654 |
| 26 | 22558 | 22742 | -11253 | 22506 | 9.852 | 10 | 0.4535 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.112 | 0.1791 | -17.38 | -3.463 | -2.761 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4625 | 0.03675 | 12.58 | 0.3904 | 0.5345 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0194 | 0.002327 | -8.337 | -0.02397 | -0.01484 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002614 | 0.00004581 | 5.706 | 0.0001716 | 0.0003512 | fixed |
| male | 0.03031 | 0.01944 | 1.559 | -0.007785 | 0.0684 | fixed |
| sibling_count3 | -0.04685 | 0.02732 | -1.715 | -0.1004 | 0.006702 | fixed |
| sibling_count4 | -0.09949 | 0.0338 | -2.944 | -0.1657 | -0.03324 | fixed |
| sibling_count5 | -0.2019 | 0.04473 | -4.514 | -0.2896 | -0.1143 | fixed |
| sibling_count5+ | -0.2519 | 0.04129 | -6.1 | -0.3328 | -0.171 | fixed |
| sd_(Intercept).mother_pidlink | 0.4914 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7689 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.086 | 0.1816 | -17 | -3.442 | -2.73 | fixed |
| birth_order | -0.00767 | 0.008849 | -0.8668 | -0.02501 | 0.009673 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.46 | 0.03687 | 12.48 | 0.3877 | 0.5322 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01928 | 0.002332 | -8.267 | -0.02385 | -0.01471 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002592 | 0.00004589 | 5.648 | 0.0001692 | 0.0003491 | fixed |
| male | 0.03038 | 0.01944 | 1.563 | -0.007719 | 0.06848 | fixed |
| sibling_count3 | -0.04173 | 0.02795 | -1.493 | -0.09651 | 0.01304 | fixed |
| sibling_count4 | -0.08812 | 0.03625 | -2.431 | -0.1592 | -0.01706 | fixed |
| sibling_count5 | -0.1833 | 0.04961 | -3.695 | -0.2805 | -0.08609 | fixed |
| sibling_count5+ | -0.2153 | 0.05902 | -3.649 | -0.331 | -0.09967 | fixed |
| sd_(Intercept).mother_pidlink | 0.4911 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7691 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.115 | 0.181 | -17.21 | -3.47 | -2.76 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4631 | 0.03688 | 12.56 | 0.3908 | 0.5354 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01947 | 0.002332 | -8.347 | -0.02404 | -0.0149 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002629 | 0.00004589 | 5.729 | 0.000173 | 0.0003529 | fixed |
| male | 0.03004 | 0.01944 | 1.545 | -0.008058 | 0.06814 | fixed |
| sibling_count3 | -0.04791 | 0.02914 | -1.644 | -0.105 | 0.009209 | fixed |
| sibling_count4 | -0.102 | 0.03901 | -2.615 | -0.1785 | -0.02556 | fixed |
| sibling_count5 | -0.1672 | 0.05419 | -3.085 | -0.2734 | -0.06097 | fixed |
| sibling_count5+ | -0.2479 | 0.06378 | -3.887 | -0.3729 | -0.1229 | fixed |
| birth_order_nonlinear2 | 0.003997 | 0.02302 | 0.1737 | -0.04112 | 0.04911 | fixed |
| birth_order_nonlinear3 | 0.003994 | 0.03243 | 0.1232 | -0.05957 | 0.06756 | fixed |
| birth_order_nonlinear4 | 0.006891 | 0.04507 | 0.1529 | -0.08144 | 0.09523 | fixed |
| birth_order_nonlinear5 | -0.1106 | 0.06204 | -1.782 | -0.2322 | 0.01102 | fixed |
| birth_order_nonlinear5+ | 0.02731 | 0.07101 | 0.3846 | -0.1119 | 0.1665 | fixed |
| sd_(Intercept).mother_pidlink | 0.4917 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7688 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.121 | 0.1818 | -17.17 | -3.478 | -2.765 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4648 | 0.03695 | 12.58 | 0.3924 | 0.5372 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01959 | 0.002337 | -8.384 | -0.02417 | -0.01501 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002656 | 0.00004598 | 5.776 | 0.0001754 | 0.0003557 | fixed |
| male | 0.03075 | 0.01944 | 1.582 | -0.00735 | 0.06886 | fixed |
| count_birth_order2/2 | 0.001768 | 0.03197 | 0.0553 | -0.06088 | 0.06442 | fixed |
| count_birth_order1/3 | -0.06413 | 0.03815 | -1.681 | -0.1389 | 0.01064 | fixed |
| count_birth_order2/3 | -0.05242 | 0.03664 | -1.431 | -0.1242 | 0.0194 | fixed |
| count_birth_order3/3 | -0.0167 | 0.04017 | -0.4156 | -0.09543 | 0.06203 | fixed |
| count_birth_order1/4 | -0.0457 | 0.06025 | -0.7585 | -0.1638 | 0.07239 | fixed |
| count_birth_order2/4 | -0.07186 | 0.05325 | -1.349 | -0.1762 | 0.03251 | fixed |
| count_birth_order3/4 | -0.1843 | 0.05056 | -3.645 | -0.2834 | -0.08519 | fixed |
| count_birth_order4/4 | -0.07292 | 0.05041 | -1.447 | -0.1717 | 0.02587 | fixed |
| count_birth_order1/5 | -0.1909 | 0.1042 | -1.832 | -0.3952 | 0.01334 | fixed |
| count_birth_order2/5 | -0.1379 | 0.09972 | -1.383 | -0.3334 | 0.05753 | fixed |
| count_birth_order3/5 | -0.07514 | 0.0808 | -0.9299 | -0.2335 | 0.08323 | fixed |
| count_birth_order4/5 | -0.2494 | 0.06853 | -3.639 | -0.3837 | -0.115 | fixed |
| count_birth_order5/5 | -0.2528 | 0.06699 | -3.774 | -0.3841 | -0.1215 | fixed |
| count_birth_order1/5+ | -0.2926 | 0.1343 | -2.179 | -0.5557 | -0.02945 | fixed |
| count_birth_order2/5+ | -0.2989 | 0.1239 | -2.412 | -0.5418 | -0.05605 | fixed |
| count_birth_order3/5+ | -0.2104 | 0.1014 | -2.076 | -0.4091 | -0.01174 | fixed |
| count_birth_order4/5+ | -0.1581 | 0.09617 | -1.644 | -0.3466 | 0.03035 | fixed |
| count_birth_order5/5+ | -0.3945 | 0.07643 | -5.161 | -0.5443 | -0.2447 | fixed |
| count_birth_order5+/5+ | -0.2215 | 0.05033 | -4.401 | -0.3202 | -0.1229 | fixed |
| sd_(Intercept).mother_pidlink | 0.4926 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7681 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 21616 | 21693 | -10797 | 21594 | NA | NA | NA |
| 12 | 21617 | 21701 | -10796 | 21593 | 0.753 | 1 | 0.3855 |
| 16 | 21620 | 21732 | -10794 | 21588 | 4.805 | 4 | 0.3079 |
| 26 | 21627 | 21810 | -10788 | 21575 | 12.77 | 10 | 0.2369 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = math_2015_young)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.466 | 0.1215 | -20.3 | -2.704 | -2.228 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4048 | 0.02252 | 17.97 | 0.3606 | 0.4489 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01815 | 0.001303 | -13.93 | -0.02071 | -0.0156 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002515 | 0.00002388 | 10.53 | 0.0002047 | 0.0002983 | fixed |
| male | -0.1617 | 0.01737 | -9.306 | -0.1957 | -0.1276 | fixed |
| sibling_count3 | -0.003588 | 0.02894 | -0.124 | -0.06031 | 0.05313 | fixed |
| sibling_count4 | -0.08819 | 0.03232 | -2.729 | -0.1515 | -0.02485 | fixed |
| sibling_count5 | -0.04881 | 0.0364 | -1.341 | -0.1202 | 0.02254 | fixed |
| sibling_count5+ | -0.2076 | 0.02899 | -7.16 | -0.2644 | -0.1508 | fixed |
| sd_(Intercept).mother_pidlink | 0.4412 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.857 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.454 | 0.1219 | -20.14 | -2.693 | -2.215 | fixed |
| birth_order | -0.00565 | 0.004521 | -1.25 | -0.01451 | 0.003212 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4044 | 0.02252 | 17.95 | 0.3602 | 0.4485 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01814 | 0.001303 | -13.93 | -0.0207 | -0.01559 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002512 | 0.00002388 | 10.52 | 0.0002044 | 0.000298 | fixed |
| male | -0.1616 | 0.01737 | -9.302 | -0.1956 | -0.1275 | fixed |
| sibling_count3 | -0.000338 | 0.02905 | -0.01163 | -0.05728 | 0.05661 | fixed |
| sibling_count4 | -0.08042 | 0.0329 | -2.444 | -0.1449 | -0.01593 | fixed |
| sibling_count5 | -0.03629 | 0.03775 | -0.9613 | -0.1103 | 0.0377 | fixed |
| sibling_count5+ | -0.1764 | 0.03825 | -4.612 | -0.2514 | -0.1014 | fixed |
| sd_(Intercept).mother_pidlink | 0.4408 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8571 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.481 | 0.1229 | -20.18 | -2.722 | -2.24 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4066 | 0.02259 | 18 | 0.3624 | 0.4509 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01824 | 0.001304 | -13.98 | -0.02079 | -0.01568 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002523 | 0.00002389 | 10.56 | 0.0002055 | 0.0002992 | fixed |
| male | -0.1618 | 0.01737 | -9.315 | -0.1959 | -0.1278 | fixed |
| sibling_count3 | -0.01878 | 0.03001 | -0.6259 | -0.07759 | 0.04003 | fixed |
| sibling_count4 | -0.09841 | 0.03565 | -2.76 | -0.1683 | -0.02853 | fixed |
| sibling_count5 | -0.04989 | 0.04188 | -1.191 | -0.132 | 0.03219 | fixed |
| sibling_count5+ | -0.1826 | 0.04255 | -4.29 | -0.266 | -0.09916 | fixed |
| birth_order_nonlinear2 | 0.01111 | 0.02393 | 0.4642 | -0.03579 | 0.058 | fixed |
| birth_order_nonlinear3 | 0.06162 | 0.03008 | 2.048 | 0.002657 | 0.1206 | fixed |
| birth_order_nonlinear4 | -0.02853 | 0.03724 | -0.7662 | -0.1015 | 0.04445 | fixed |
| birth_order_nonlinear5 | -0.008226 | 0.04369 | -0.1883 | -0.09387 | 0.07741 | fixed |
| birth_order_nonlinear5+ | -0.03737 | 0.04097 | -0.912 | -0.1177 | 0.04294 | fixed |
| sd_(Intercept).mother_pidlink | 0.4416 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8566 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.495 | 0.1239 | -20.13 | -2.738 | -2.252 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4073 | 0.02263 | 18 | 0.363 | 0.4517 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01828 | 0.001306 | -13.99 | -0.02084 | -0.01572 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002531 | 0.00002392 | 10.58 | 0.0002062 | 0.0003 | fixed |
| male | -0.1617 | 0.01738 | -9.306 | -0.1958 | -0.1277 | fixed |
| count_birth_order2/2 | 0.0442 | 0.0389 | 1.136 | -0.03205 | 0.1204 | fixed |
| count_birth_order1/3 | 0.003874 | 0.03882 | 0.09977 | -0.07222 | 0.07997 | fixed |
| count_birth_order2/3 | 0.01011 | 0.03964 | 0.2552 | -0.06758 | 0.08781 | fixed |
| count_birth_order3/3 | 0.02486 | 0.04499 | 0.5525 | -0.06332 | 0.113 | fixed |
| count_birth_order1/4 | -0.09987 | 0.05334 | -1.872 | -0.2044 | 0.004673 | fixed |
| count_birth_order2/4 | -0.08891 | 0.05068 | -1.754 | -0.1882 | 0.01042 | fixed |
| count_birth_order3/4 | -0.031 | 0.04767 | -0.6502 | -0.1244 | 0.06244 | fixed |
| count_birth_order4/4 | -0.0841 | 0.05214 | -1.613 | -0.1863 | 0.01808 | fixed |
| count_birth_order1/5 | -0.03411 | 0.07281 | -0.4685 | -0.1768 | 0.1086 | fixed |
| count_birth_order2/5 | -0.04574 | 0.06923 | -0.6606 | -0.1814 | 0.08996 | fixed |
| count_birth_order3/5 | 0.04814 | 0.06259 | 0.7691 | -0.07453 | 0.1708 | fixed |
| count_birth_order4/5 | -0.1116 | 0.05873 | -1.9 | -0.2267 | 0.003508 | fixed |
| count_birth_order5/5 | -0.01722 | 0.05821 | -0.2958 | -0.1313 | 0.09687 | fixed |
| count_birth_order1/5+ | -0.1167 | 0.07317 | -1.595 | -0.2601 | 0.02668 | fixed |
| count_birth_order2/5+ | -0.2274 | 0.06847 | -3.322 | -0.3616 | -0.09323 | fixed |
| count_birth_order3/5+ | -0.06418 | 0.06079 | -1.056 | -0.1833 | 0.05497 | fixed |
| count_birth_order4/5+ | -0.1983 | 0.05525 | -3.589 | -0.3066 | -0.09001 | fixed |
| count_birth_order5/5+ | -0.1984 | 0.04952 | -4.007 | -0.2954 | -0.1013 | fixed |
| count_birth_order5+/5+ | -0.209 | 0.03399 | -6.149 | -0.2756 | -0.1424 | fixed |
| sd_(Intercept).mother_pidlink | 0.4408 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8571 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 32480 | 32561 | -16229 | 32458 | NA | NA | NA |
| 12 | 32480 | 32569 | -16228 | 32456 | 1.564 | 1 | 0.2111 |
| 16 | 32480 | 32598 | -16224 | 32448 | 7.826 | 4 | 0.09815 |
| 26 | 32494 | 32686 | -16221 | 32442 | 6.537 | 10 | 0.7683 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.104 | 0.1915 | -16.21 | -3.48 | -2.729 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5371 | 0.03932 | 13.66 | 0.4601 | 0.6142 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02639 | 0.002491 | -10.59 | -0.03128 | -0.02151 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004132 | 0.00004907 | 8.422 | 0.0003171 | 0.0005094 | fixed |
| male | -0.1782 | 0.0206 | -8.647 | -0.2185 | -0.1378 | fixed |
| sibling_count3 | -0.004614 | 0.02826 | -0.1633 | -0.06001 | 0.05078 | fixed |
| sibling_count4 | -0.0559 | 0.03451 | -1.62 | -0.1235 | 0.01174 | fixed |
| sibling_count5 | -0.1578 | 0.04412 | -3.575 | -0.2442 | -0.07127 | fixed |
| sibling_count5+ | -0.2106 | 0.04109 | -5.126 | -0.2911 | -0.1301 | fixed |
| sd_(Intercept).mother_pidlink | 0.4467 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8555 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.11 | 0.1937 | -16.06 | -3.49 | -2.731 | fixed |
| birth_order | 0.001986 | 0.009122 | 0.2177 | -0.01589 | 0.01987 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5377 | 0.03941 | 13.64 | 0.4605 | 0.615 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02642 | 0.002495 | -10.59 | -0.03131 | -0.02153 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004138 | 0.00004912 | 8.423 | 0.0003175 | 0.00051 | fixed |
| male | -0.1782 | 0.0206 | -8.647 | -0.2186 | -0.1378 | fixed |
| sibling_count3 | -0.005917 | 0.02889 | -0.2048 | -0.06254 | 0.05071 | fixed |
| sibling_count4 | -0.05879 | 0.03699 | -1.589 | -0.1313 | 0.0137 | fixed |
| sibling_count5 | -0.1626 | 0.04936 | -3.293 | -0.2593 | -0.06582 | fixed |
| sibling_count5+ | -0.22 | 0.05974 | -3.683 | -0.3371 | -0.1029 | fixed |
| sd_(Intercept).mother_pidlink | 0.4468 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8555 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.126 | 0.1933 | -16.18 | -3.505 | -2.747 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5394 | 0.03943 | 13.68 | 0.4621 | 0.6166 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02653 | 0.002495 | -10.63 | -0.03142 | -0.02164 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004159 | 0.00004913 | 8.465 | 0.0003196 | 0.0005122 | fixed |
| male | -0.1786 | 0.02061 | -8.664 | -0.2189 | -0.1382 | fixed |
| sibling_count3 | -0.00646 | 0.03024 | -0.2136 | -0.06573 | 0.05281 | fixed |
| sibling_count4 | -0.05353 | 0.04007 | -1.336 | -0.1321 | 0.025 | fixed |
| sibling_count5 | -0.1354 | 0.05447 | -2.485 | -0.2421 | -0.02859 | fixed |
| sibling_count5+ | -0.2334 | 0.06479 | -3.603 | -0.3604 | -0.1065 | fixed |
| birth_order_nonlinear2 | 0.02891 | 0.02498 | 1.157 | -0.02005 | 0.07787 | fixed |
| birth_order_nonlinear3 | 0.004704 | 0.03478 | 0.1352 | -0.06347 | 0.07288 | fixed |
| birth_order_nonlinear4 | -0.002522 | 0.04752 | -0.05308 | -0.09565 | 0.09061 | fixed |
| birth_order_nonlinear5 | -0.04888 | 0.06391 | -0.7648 | -0.1741 | 0.07638 | fixed |
| birth_order_nonlinear5+ | 0.07078 | 0.07314 | 0.9677 | -0.07258 | 0.2141 | fixed |
| sd_(Intercept).mother_pidlink | 0.447 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8554 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.134 | 0.1942 | -16.14 | -3.514 | -2.753 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5388 | 0.03953 | 13.63 | 0.4614 | 0.6163 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0265 | 0.002502 | -10.59 | -0.0314 | -0.02159 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004153 | 0.00004926 | 8.43 | 0.0003187 | 0.0005118 | fixed |
| male | -0.1777 | 0.02062 | -8.619 | -0.2182 | -0.1373 | fixed |
| count_birth_order2/2 | 0.05606 | 0.03495 | 1.604 | -0.01245 | 0.1246 | fixed |
| count_birth_order1/3 | 0.03115 | 0.04032 | 0.7725 | -0.04788 | 0.1102 | fixed |
| count_birth_order2/3 | 0.02824 | 0.0388 | 0.7279 | -0.0478 | 0.1043 | fixed |
| count_birth_order3/3 | -0.01949 | 0.04253 | -0.4582 | -0.1028 | 0.06387 | fixed |
| count_birth_order1/4 | -0.082 | 0.06396 | -1.282 | -0.2074 | 0.04337 | fixed |
| count_birth_order2/4 | -0.06803 | 0.05601 | -1.215 | -0.1778 | 0.04174 | fixed |
| count_birth_order3/4 | -0.009767 | 0.05347 | -0.1827 | -0.1146 | 0.09503 | fixed |
| count_birth_order4/4 | -0.007113 | 0.05289 | -0.1345 | -0.1108 | 0.09656 | fixed |
| count_birth_order1/5 | -0.079 | 0.1123 | -0.7037 | -0.299 | 0.141 | fixed |
| count_birth_order2/5 | -0.0711 | 0.09979 | -0.7125 | -0.2667 | 0.1245 | fixed |
| count_birth_order3/5 | -0.07822 | 0.08421 | -0.9289 | -0.2433 | 0.08682 | fixed |
| count_birth_order4/5 | -0.1583 | 0.0694 | -2.281 | -0.2943 | -0.0223 | fixed |
| count_birth_order5/5 | -0.192 | 0.06727 | -2.855 | -0.3239 | -0.06018 | fixed |
| count_birth_order1/5+ | -0.1892 | 0.1439 | -1.315 | -0.4711 | 0.0928 | fixed |
| count_birth_order2/5+ | -0.1647 | 0.1316 | -1.252 | -0.4226 | 0.09312 | fixed |
| count_birth_order3/5+ | -0.2041 | 0.1084 | -1.883 | -0.4165 | 0.008378 | fixed |
| count_birth_order4/5+ | -0.3053 | 0.09716 | -3.142 | -0.4957 | -0.1148 | fixed |
| count_birth_order5/5+ | -0.2496 | 0.07779 | -3.208 | -0.4021 | -0.09711 | fixed |
| count_birth_order5+/5+ | -0.1526 | 0.05088 | -2.999 | -0.2523 | -0.05286 | fixed |
| sd_(Intercept).mother_pidlink | 0.446 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8561 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 23286 | 23364 | -11632 | 23264 | NA | NA | NA |
| 12 | 23288 | 23373 | -11632 | 23264 | 0.04718 | 1 | 0.828 |
| 16 | 23292 | 23405 | -11630 | 23260 | 4.367 | 4 | 0.3586 |
| 26 | 23305 | 23489 | -11627 | 23253 | 6.595 | 10 | 0.7631 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.094 | 0.1905 | -16.24 | -3.467 | -2.72 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5341 | 0.03912 | 13.65 | 0.4575 | 0.6108 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02625 | 0.00248 | -10.58 | -0.03111 | -0.02139 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004103 | 0.00004886 | 8.398 | 0.0003145 | 0.0005061 | fixed |
| male | -0.1813 | 0.02048 | -8.849 | -0.2214 | -0.1411 | fixed |
| sibling_count3 | 0.01962 | 0.02964 | 0.6619 | -0.03847 | 0.0777 | fixed |
| sibling_count4 | -0.04539 | 0.03474 | -1.307 | -0.1135 | 0.02269 | fixed |
| sibling_count5 | -0.05441 | 0.0406 | -1.34 | -0.134 | 0.02517 | fixed |
| sibling_count5+ | -0.1553 | 0.03618 | -4.292 | -0.2262 | -0.08437 | fixed |
| sd_(Intercept).mother_pidlink | 0.4484 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8547 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.063 | 0.1921 | -15.94 | -3.439 | -2.686 | fixed |
| birth_order | -0.009473 | 0.007631 | -1.241 | -0.02443 | 0.005484 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5313 | 0.03919 | 13.56 | 0.4544 | 0.6081 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02611 | 0.002483 | -10.52 | -0.03098 | -0.02125 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004079 | 0.0000489 | 8.342 | 0.0003121 | 0.0005037 | fixed |
| male | -0.181 | 0.02048 | -8.835 | -0.2211 | -0.1408 | fixed |
| sibling_count3 | 0.02553 | 0.03001 | 0.8508 | -0.03329 | 0.08435 | fixed |
| sibling_count4 | -0.0321 | 0.03634 | -0.8832 | -0.1033 | 0.03913 | fixed |
| sibling_count5 | -0.03351 | 0.04394 | -0.7625 | -0.1196 | 0.05262 | fixed |
| sibling_count5+ | -0.1126 | 0.04991 | -2.256 | -0.2105 | -0.0148 | fixed |
| sd_(Intercept).mother_pidlink | 0.4477 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.855 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.096 | 0.192 | -16.12 | -3.473 | -2.72 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5334 | 0.03921 | 13.61 | 0.4566 | 0.6103 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02621 | 0.002483 | -10.56 | -0.03107 | -0.02134 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004093 | 0.00004889 | 8.372 | 0.0003135 | 0.0005052 | fixed |
| male | -0.1816 | 0.02048 | -8.865 | -0.2217 | -0.1414 | fixed |
| sibling_count3 | 0.008918 | 0.03129 | 0.2851 | -0.0524 | 0.07024 | fixed |
| sibling_count4 | -0.04393 | 0.03939 | -1.115 | -0.1211 | 0.03326 | fixed |
| sibling_count5 | -0.02658 | 0.04819 | -0.5516 | -0.121 | 0.06787 | fixed |
| sibling_count5+ | -0.1216 | 0.05324 | -2.285 | -0.226 | -0.01729 | fixed |
| birth_order_nonlinear2 | 0.01922 | 0.02567 | 0.7485 | -0.0311 | 0.06954 | fixed |
| birth_order_nonlinear3 | 0.03887 | 0.03402 | 1.143 | -0.0278 | 0.1055 | fixed |
| birth_order_nonlinear4 | -0.03314 | 0.04453 | -0.7443 | -0.1204 | 0.05414 | fixed |
| birth_order_nonlinear5 | -0.07932 | 0.05598 | -1.417 | -0.189 | 0.03039 | fixed |
| birth_order_nonlinear5+ | -0.02667 | 0.06012 | -0.4437 | -0.1445 | 0.09115 | fixed |
| sd_(Intercept).mother_pidlink | 0.449 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8544 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.101 | 0.193 | -16.06 | -3.479 | -2.722 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5322 | 0.03927 | 13.55 | 0.4552 | 0.6092 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02612 | 0.002487 | -10.51 | -0.031 | -0.02125 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004076 | 0.00004897 | 8.324 | 0.0003116 | 0.0005036 | fixed |
| male | -0.1814 | 0.02049 | -8.852 | -0.2216 | -0.1412 | fixed |
| count_birth_order2/2 | 0.04505 | 0.03813 | 1.182 | -0.02967 | 0.1198 | fixed |
| count_birth_order1/3 | 0.05846 | 0.0417 | 1.402 | -0.02328 | 0.1402 | fixed |
| count_birth_order2/3 | 0.03561 | 0.0408 | 0.8727 | -0.04436 | 0.1156 | fixed |
| count_birth_order3/3 | 0.009352 | 0.04477 | 0.2089 | -0.07839 | 0.09709 | fixed |
| count_birth_order1/4 | -0.1275 | 0.0624 | -2.043 | -0.2498 | -0.005167 | fixed |
| count_birth_order2/4 | -0.05352 | 0.05596 | -0.9563 | -0.1632 | 0.05616 | fixed |
| count_birth_order3/4 | 0.04619 | 0.05355 | 0.8626 | -0.05877 | 0.1512 | fixed |
| count_birth_order4/4 | -0.01379 | 0.05409 | -0.2549 | -0.1198 | 0.09222 | fixed |
| count_birth_order1/5 | 0.04611 | 0.09122 | 0.5055 | -0.1327 | 0.2249 | fixed |
| count_birth_order2/5 | -0.02527 | 0.08146 | -0.3102 | -0.1849 | 0.1344 | fixed |
| count_birth_order3/5 | 0.07466 | 0.07305 | 1.022 | -0.06851 | 0.2178 | fixed |
| count_birth_order4/5 | -0.09296 | 0.06719 | -1.384 | -0.2246 | 0.03873 | fixed |
| count_birth_order5/5 | -0.108 | 0.06459 | -1.672 | -0.2346 | 0.0186 | fixed |
| count_birth_order1/5+ | -0.1115 | 0.09781 | -1.14 | -0.3032 | 0.08019 | fixed |
| count_birth_order2/5+ | -0.04052 | 0.109 | -0.3718 | -0.2542 | 0.1731 | fixed |
| count_birth_order3/5+ | -0.05131 | 0.08401 | -0.6108 | -0.216 | 0.1133 | fixed |
| count_birth_order4/5+ | -0.2026 | 0.07702 | -2.63 | -0.3535 | -0.05163 | fixed |
| count_birth_order5/5+ | -0.1804 | 0.06692 | -2.697 | -0.3116 | -0.04929 | fixed |
| count_birth_order5+/5+ | -0.139 | 0.04611 | -3.015 | -0.2294 | -0.04864 | fixed |
| sd_(Intercept).mother_pidlink | 0.4485 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8545 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 23568 | 23646 | -11773 | 23546 | NA | NA | NA |
| 12 | 23568 | 23653 | -11772 | 23544 | 1.543 | 1 | 0.2141 |
| 16 | 23572 | 23685 | -11770 | 23540 | 4.59 | 4 | 0.332 |
| 26 | 23580 | 23763 | -11764 | 23528 | 12.22 | 10 | 0.2709 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.076 | 0.1931 | -15.93 | -3.455 | -2.698 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5318 | 0.03963 | 13.42 | 0.4541 | 0.6095 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02602 | 0.00251 | -10.37 | -0.03094 | -0.0211 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004051 | 0.0000494 | 8.201 | 0.0003083 | 0.0005019 | fixed |
| male | -0.1757 | 0.02083 | -8.438 | -0.2166 | -0.1349 | fixed |
| sibling_count3 | -0.01308 | 0.02837 | -0.461 | -0.06868 | 0.04252 | fixed |
| sibling_count4 | -0.05899 | 0.03492 | -1.689 | -0.1274 | 0.00945 | fixed |
| sibling_count5 | -0.1589 | 0.04606 | -3.449 | -0.2491 | -0.06859 | fixed |
| sibling_count5+ | -0.2128 | 0.04257 | -4.998 | -0.2962 | -0.1293 | fixed |
| sd_(Intercept).mother_pidlink | 0.4509 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8514 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.092 | 0.1955 | -15.81 | -3.475 | -2.708 | fixed |
| birth_order | 0.00463 | 0.009373 | 0.494 | -0.01374 | 0.023 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5333 | 0.03974 | 13.42 | 0.4554 | 0.6112 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02609 | 0.002514 | -10.38 | -0.03102 | -0.02117 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004064 | 0.00004947 | 8.216 | 0.0003095 | 0.0005034 | fixed |
| male | -0.1758 | 0.02083 | -8.439 | -0.2166 | -0.1349 | fixed |
| sibling_count3 | -0.01609 | 0.02902 | -0.5545 | -0.07296 | 0.04078 | fixed |
| sibling_count4 | -0.0657 | 0.03747 | -1.753 | -0.1392 | 0.007743 | fixed |
| sibling_count5 | -0.1699 | 0.05117 | -3.32 | -0.2702 | -0.06958 | fixed |
| sibling_count5+ | -0.2345 | 0.06122 | -3.83 | -0.3545 | -0.1145 | fixed |
| sd_(Intercept).mother_pidlink | 0.451 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8514 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.104 | 0.195 | -15.92 | -3.487 | -2.722 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.535 | 0.03977 | 13.45 | 0.4571 | 0.613 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0262 | 0.002515 | -10.42 | -0.03113 | -0.02127 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004084 | 0.00004949 | 8.251 | 0.0003114 | 0.0005054 | fixed |
| male | -0.1762 | 0.02083 | -8.455 | -0.217 | -0.1353 | fixed |
| sibling_count3 | -0.01488 | 0.03034 | -0.4904 | -0.07435 | 0.04459 | fixed |
| sibling_count4 | -0.06779 | 0.04052 | -1.673 | -0.1472 | 0.01162 | fixed |
| sibling_count5 | -0.1548 | 0.05619 | -2.754 | -0.2649 | -0.04464 | fixed |
| sibling_count5+ | -0.2456 | 0.06644 | -3.696 | -0.3758 | -0.1153 | fixed |
| birth_order_nonlinear2 | 0.02627 | 0.02496 | 1.052 | -0.02265 | 0.0752 | fixed |
| birth_order_nonlinear3 | 0.003957 | 0.03499 | 0.1131 | -0.06463 | 0.07254 | fixed |
| birth_order_nonlinear4 | 0.03323 | 0.04852 | 0.6848 | -0.06187 | 0.1283 | fixed |
| birth_order_nonlinear5 | -0.02669 | 0.06674 | -0.3999 | -0.1575 | 0.1041 | fixed |
| birth_order_nonlinear5+ | 0.07335 | 0.07557 | 0.9707 | -0.07476 | 0.2215 | fixed |
| sd_(Intercept).mother_pidlink | 0.4505 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8517 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.108 | 0.1959 | -15.87 | -3.492 | -2.724 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5337 | 0.03987 | 13.39 | 0.4556 | 0.6119 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02612 | 0.002521 | -10.36 | -0.03107 | -0.02118 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0004071 | 0.00004962 | 8.205 | 0.0003098 | 0.0005043 | fixed |
| male | -0.1755 | 0.02085 | -8.42 | -0.2164 | -0.1347 | fixed |
| count_birth_order2/2 | 0.05598 | 0.0346 | 1.618 | -0.01183 | 0.1238 | fixed |
| count_birth_order1/3 | 0.0261 | 0.04051 | 0.6443 | -0.0533 | 0.1055 | fixed |
| count_birth_order2/3 | 0.01806 | 0.03892 | 0.464 | -0.05822 | 0.09434 | fixed |
| count_birth_order3/3 | -0.02986 | 0.04272 | -0.6989 | -0.1136 | 0.05387 | fixed |
| count_birth_order1/4 | -0.09554 | 0.06434 | -1.485 | -0.2216 | 0.03056 | fixed |
| count_birth_order2/4 | -0.0866 | 0.05675 | -1.526 | -0.1978 | 0.02463 | fixed |
| count_birth_order3/4 | -0.0142 | 0.05387 | -0.2637 | -0.1198 | 0.09137 | fixed |
| count_birth_order4/4 | 0.009754 | 0.05365 | 0.1818 | -0.0954 | 0.1149 | fixed |
| count_birth_order1/5 | -0.05029 | 0.1121 | -0.4487 | -0.2699 | 0.1694 | fixed |
| count_birth_order2/5 | -0.1172 | 0.1071 | -1.094 | -0.3272 | 0.09276 | fixed |
| count_birth_order3/5 | -0.1053 | 0.08641 | -1.218 | -0.2747 | 0.06408 | fixed |
| count_birth_order4/5 | -0.123 | 0.07302 | -1.685 | -0.2661 | 0.02011 | fixed |
| count_birth_order5/5 | -0.2081 | 0.0713 | -2.919 | -0.3479 | -0.0684 | fixed |
| count_birth_order1/5+ | -0.2608 | 0.145 | -1.799 | -0.545 | 0.02333 | fixed |
| count_birth_order2/5+ | -0.1588 | 0.1336 | -1.188 | -0.4207 | 0.1031 | fixed |
| count_birth_order3/5+ | -0.2241 | 0.1089 | -2.058 | -0.4375 | -0.01066 | fixed |
| count_birth_order4/5+ | -0.3077 | 0.1033 | -2.979 | -0.5102 | -0.1052 | fixed |
| count_birth_order5/5+ | -0.2128 | 0.08176 | -2.602 | -0.373 | -0.05251 | fixed |
| count_birth_order5+/5+ | -0.1609 | 0.05288 | -3.043 | -0.2646 | -0.05726 | fixed |
| sd_(Intercept).mother_pidlink | 0.4492 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8523 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 22637 | 22714 | -11307 | 22615 | NA | NA | NA |
| 12 | 22638 | 22723 | -11307 | 22614 | 0.2439 | 1 | 0.6214 |
| 16 | 22643 | 22756 | -11306 | 22611 | 3.053 | 4 | 0.549 |
| 26 | 22655 | 22837 | -11302 | 22603 | 8.409 | 10 | 0.5889 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = raven_2007_old)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.555 | 1.991 | -2.79 | -9.456 | -1.653 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.62 | 0.207 | 2.996 | 0.2143 | 1.026 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02159 | 0.007077 | -3.05 | -0.03546 | -0.007718 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002391 | 0.00007963 | 3.003 | 0.00008304 | 0.0003952 | fixed |
| male | 0.1589 | 0.02117 | 7.507 | 0.1174 | 0.2004 | fixed |
| sibling_count3 | -0.02469 | 0.05681 | -0.4346 | -0.136 | 0.08666 | fixed |
| sibling_count4 | -0.1125 | 0.05551 | -2.027 | -0.2213 | -0.003706 | fixed |
| sibling_count5 | -0.02214 | 0.05634 | -0.393 | -0.1326 | 0.08828 | fixed |
| sibling_count5+ | -0.252 | 0.0464 | -5.432 | -0.343 | -0.1611 | fixed |
| sd_(Intercept).mother_pidlink | 0.5145 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8407 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.54 | 1.991 | -2.782 | -9.443 | -1.637 | fixed |
| birth_order | -0.001469 | 0.004356 | -0.3373 | -0.01001 | 0.007068 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.6189 | 0.207 | 2.99 | 0.2132 | 1.025 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02156 | 0.007078 | -3.045 | -0.03543 | -0.007682 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002387 | 0.00007964 | 2.997 | 0.00008259 | 0.0003948 | fixed |
| male | 0.159 | 0.02117 | 7.511 | 0.1175 | 0.2005 | fixed |
| sibling_count3 | -0.02407 | 0.05684 | -0.4234 | -0.1355 | 0.08734 | fixed |
| sibling_count4 | -0.1112 | 0.05564 | -1.998 | -0.2203 | -0.002142 | fixed |
| sibling_count5 | -0.01996 | 0.05671 | -0.3519 | -0.1311 | 0.0912 | fixed |
| sibling_count5+ | -0.2462 | 0.0495 | -4.974 | -0.3433 | -0.1492 | fixed |
| sd_(Intercept).mother_pidlink | 0.5144 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8408 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.504 | 1.992 | -2.763 | -9.409 | -1.599 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.6189 | 0.2071 | 2.989 | 0.213 | 1.025 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02158 | 0.007082 | -3.047 | -0.03546 | -0.007696 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002393 | 0.00007968 | 3.003 | 0.00008312 | 0.0003955 | fixed |
| male | 0.158 | 0.02117 | 7.464 | 0.1165 | 0.1995 | fixed |
| sibling_count3 | -0.0224 | 0.05765 | -0.3885 | -0.1354 | 0.0906 | fixed |
| sibling_count4 | -0.1007 | 0.05684 | -1.772 | -0.2121 | 0.01067 | fixed |
| sibling_count5 | -0.007411 | 0.0584 | -0.1269 | -0.1219 | 0.107 | fixed |
| sibling_count5+ | -0.2452 | 0.05113 | -4.796 | -0.3454 | -0.145 | fixed |
| birth_order_nonlinear2 | -0.08067 | 0.03356 | -2.404 | -0.1464 | -0.01489 | fixed |
| birth_order_nonlinear3 | -0.04792 | 0.03615 | -1.325 | -0.1188 | 0.02294 | fixed |
| birth_order_nonlinear4 | -0.07509 | 0.03956 | -1.898 | -0.1526 | 0.002444 | fixed |
| birth_order_nonlinear5 | -0.05645 | 0.04473 | -1.262 | -0.1441 | 0.03123 | fixed |
| birth_order_nonlinear5+ | -0.03028 | 0.0381 | -0.7947 | -0.1049 | 0.04439 | fixed |
| sd_(Intercept).mother_pidlink | 0.515 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8403 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.585 | 1.994 | -2.801 | -9.492 | -1.677 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.629 | 0.2072 | 3.035 | 0.2228 | 1.035 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02193 | 0.007086 | -3.095 | -0.03582 | -0.008044 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002436 | 0.00007972 | 3.055 | 0.0000873 | 0.0003998 | fixed |
| male | 0.1577 | 0.02118 | 7.445 | 0.1162 | 0.1992 | fixed |
| count_birth_order2/2 | -0.1162 | 0.07779 | -1.493 | -0.2686 | 0.0363 | fixed |
| count_birth_order1/3 | -0.02636 | 0.07751 | -0.34 | -0.1783 | 0.1256 | fixed |
| count_birth_order2/3 | -0.07158 | 0.0828 | -0.8644 | -0.2339 | 0.09071 | fixed |
| count_birth_order3/3 | -0.1474 | 0.08305 | -1.775 | -0.3102 | 0.01532 | fixed |
| count_birth_order1/4 | -0.05173 | 0.07984 | -0.6479 | -0.2082 | 0.1048 | fixed |
| count_birth_order2/4 | -0.1402 | 0.08328 | -1.684 | -0.3035 | 0.02298 | fixed |
| count_birth_order3/4 | -0.3107 | 0.08564 | -3.628 | -0.4786 | -0.1429 | fixed |
| count_birth_order4/4 | -0.2031 | 0.08645 | -2.349 | -0.3725 | -0.03362 | fixed |
| count_birth_order1/5 | -0.05713 | 0.08748 | -0.653 | -0.2286 | 0.1143 | fixed |
| count_birth_order2/5 | -0.18 | 0.08917 | -2.018 | -0.3547 | -0.005209 | fixed |
| count_birth_order3/5 | -0.0007824 | 0.08803 | -0.008888 | -0.1733 | 0.1717 | fixed |
| count_birth_order4/5 | -0.1157 | 0.09013 | -1.284 | -0.2924 | 0.06092 | fixed |
| count_birth_order5/5 | -0.01407 | 0.0919 | -0.1531 | -0.1942 | 0.166 | fixed |
| count_birth_order1/5+ | -0.2993 | 0.06996 | -4.279 | -0.4365 | -0.1622 | fixed |
| count_birth_order2/5+ | -0.3558 | 0.07041 | -5.053 | -0.4938 | -0.2178 | fixed |
| count_birth_order3/5+ | -0.2488 | 0.06923 | -3.594 | -0.3845 | -0.1131 | fixed |
| count_birth_order4/5+ | -0.3295 | 0.06798 | -4.847 | -0.4627 | -0.1962 | fixed |
| count_birth_order5/5+ | -0.3357 | 0.06877 | -4.881 | -0.4705 | -0.2009 | fixed |
| count_birth_order5+/5+ | -0.2904 | 0.06009 | -4.832 | -0.4082 | -0.1726 | fixed |
| sd_(Intercept).mother_pidlink | 0.5126 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8409 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 22194 | 22271 | -11086 | 22172 | NA | NA | NA |
| 12 | 22196 | 22280 | -11086 | 22172 | 0.1146 | 1 | 0.735 |
| 16 | 22197 | 22309 | -11083 | 22165 | 7.31 | 4 | 0.1204 |
| 26 | 22200 | 22382 | -11074 | 22148 | 16.95 | 10 | 0.07548 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.623 | 3.55 | -1.584 | -12.58 | 1.335 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.6273 | 0.3694 | 1.698 | -0.09661 | 1.351 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02163 | 0.01263 | -1.713 | -0.04638 | 0.003113 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002424 | 0.0001419 | 1.708 | -0.00003571 | 0.0005205 | fixed |
| male | 0.1013 | 0.02818 | 3.595 | 0.04608 | 0.1565 | fixed |
| sibling_count3 | -0.0009628 | 0.05098 | -0.01889 | -0.1009 | 0.09895 | fixed |
| sibling_count4 | -0.1017 | 0.05264 | -1.933 | -0.2049 | 0.001433 | fixed |
| sibling_count5 | -0.1673 | 0.05745 | -2.911 | -0.2798 | -0.05466 | fixed |
| sibling_count5+ | -0.285 | 0.04968 | -5.736 | -0.3824 | -0.1876 | fixed |
| sd_(Intercept).mother_pidlink | 0.4319 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7512 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.809 | 3.549 | -1.637 | -12.76 | 1.147 | fixed |
| birth_order | 0.01696 | 0.009109 | 1.862 | -0.0008961 | 0.03481 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.6437 | 0.3692 | 1.743 | -0.07996 | 1.367 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02221 | 0.01262 | -1.76 | -0.04695 | 0.002527 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002496 | 0.0001418 | 1.759 | -0.00002846 | 0.0005276 | fixed |
| male | 0.09962 | 0.02818 | 3.535 | 0.04439 | 0.1548 | fixed |
| sibling_count3 | -0.008611 | 0.05115 | -0.1683 | -0.1089 | 0.09164 | fixed |
| sibling_count4 | -0.1211 | 0.05368 | -2.256 | -0.2263 | -0.01587 | fixed |
| sibling_count5 | -0.1989 | 0.05992 | -3.319 | -0.3163 | -0.08145 | fixed |
| sibling_count5+ | -0.3465 | 0.05965 | -5.809 | -0.4634 | -0.2296 | fixed |
| sd_(Intercept).mother_pidlink | 0.4335 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7501 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.094 | 3.552 | -1.716 | -13.06 | 0.8668 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.6757 | 0.3695 | 1.829 | -0.04856 | 1.4 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02331 | 0.01263 | -1.845 | -0.04807 | 0.001449 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000262 | 0.000142 | 1.846 | -0.0000162 | 0.0005402 | fixed |
| male | 0.09972 | 0.02816 | 3.542 | 0.04453 | 0.1549 | fixed |
| sibling_count3 | -0.0143 | 0.05181 | -0.2761 | -0.1159 | 0.08725 | fixed |
| sibling_count4 | -0.1186 | 0.05549 | -2.137 | -0.2273 | -0.009797 | fixed |
| sibling_count5 | -0.1841 | 0.06264 | -2.939 | -0.3069 | -0.06134 | fixed |
| sibling_count5+ | -0.3681 | 0.06103 | -6.031 | -0.4877 | -0.2484 | fixed |
| birth_order_nonlinear2 | 0.001955 | 0.03711 | 0.05268 | -0.07078 | 0.07469 | fixed |
| birth_order_nonlinear3 | 0.05547 | 0.04397 | 1.261 | -0.03072 | 0.1417 | fixed |
| birth_order_nonlinear4 | 0.001765 | 0.05378 | 0.03282 | -0.1036 | 0.1072 | fixed |
| birth_order_nonlinear5 | 0.006667 | 0.06523 | 0.1022 | -0.1212 | 0.1345 | fixed |
| birth_order_nonlinear5+ | 0.1875 | 0.06536 | 2.868 | 0.05937 | 0.3156 | fixed |
| sd_(Intercept).mother_pidlink | 0.434 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7494 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.348 | 3.556 | -1.785 | -13.32 | 0.6221 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7056 | 0.37 | 1.907 | -0.01961 | 1.431 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02436 | 0.01265 | -1.926 | -0.04916 | 0.0004275 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002743 | 0.0001421 | 1.929 | -0.000004341 | 0.0005529 | fixed |
| male | 0.1005 | 0.02819 | 3.564 | 0.04522 | 0.1557 | fixed |
| count_birth_order2/2 | -0.06828 | 0.07074 | -0.9652 | -0.2069 | 0.07037 | fixed |
| count_birth_order1/3 | -0.05194 | 0.06509 | -0.798 | -0.1795 | 0.07564 | fixed |
| count_birth_order2/3 | 0.02114 | 0.0713 | 0.2966 | -0.1186 | 0.1609 | fixed |
| count_birth_order3/3 | -0.04072 | 0.07914 | -0.5146 | -0.1958 | 0.1144 | fixed |
| count_birth_order1/4 | -0.1329 | 0.07592 | -1.751 | -0.2817 | 0.01585 | fixed |
| count_birth_order2/4 | -0.1618 | 0.0776 | -2.086 | -0.3139 | -0.009757 | fixed |
| count_birth_order3/4 | -0.1453 | 0.07867 | -1.847 | -0.2995 | 0.00886 | fixed |
| count_birth_order4/4 | -0.06372 | 0.0855 | -0.7453 | -0.2313 | 0.1039 | fixed |
| count_birth_order1/5 | -0.2621 | 0.09772 | -2.682 | -0.4536 | -0.07053 | fixed |
| count_birth_order2/5 | -0.282 | 0.1013 | -2.785 | -0.4805 | -0.08352 | fixed |
| count_birth_order3/5 | -0.02152 | 0.09263 | -0.2323 | -0.2031 | 0.16 | fixed |
| count_birth_order4/5 | -0.2723 | 0.09185 | -2.965 | -0.4523 | -0.09228 | fixed |
| count_birth_order5/5 | -0.154 | 0.09646 | -1.596 | -0.343 | 0.03509 | fixed |
| count_birth_order1/5+ | -0.4131 | 0.09369 | -4.409 | -0.5967 | -0.2294 | fixed |
| count_birth_order2/5+ | -0.3539 | 0.09094 | -3.892 | -0.5322 | -0.1757 | fixed |
| count_birth_order3/5+ | -0.2987 | 0.08559 | -3.489 | -0.4664 | -0.1309 | fixed |
| count_birth_order4/5+ | -0.4136 | 0.08515 | -4.857 | -0.5805 | -0.2467 | fixed |
| count_birth_order5/5+ | -0.4167 | 0.08265 | -5.042 | -0.5787 | -0.2547 | fixed |
| count_birth_order5+/5+ | -0.2074 | 0.06516 | -3.183 | -0.3351 | -0.07967 | fixed |
| sd_(Intercept).mother_pidlink | 0.4347 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7488 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 9087 | 9155 | -4533 | 9065 | NA | NA | NA |
| 12 | 9086 | 9160 | -4531 | 9062 | 3.462 | 1 | 0.06281 |
| 16 | 9086 | 9185 | -4527 | 9054 | 8.221 | 4 | 0.08383 |
| 26 | 9094 | 9255 | -4521 | 9042 | 11.85 | 10 | 0.2952 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.806 | 3.542 | -1.639 | -12.75 | 1.135 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.649 | 0.3685 | 1.761 | -0.07334 | 1.371 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02239 | 0.0126 | -1.778 | -0.04709 | 0.002298 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002508 | 0.0001416 | 1.772 | -0.00002667 | 0.0005283 | fixed |
| male | 0.1003 | 0.0281 | 3.569 | 0.04521 | 0.1554 | fixed |
| sibling_count3 | -0.04235 | 0.05637 | -0.7513 | -0.1528 | 0.06813 | fixed |
| sibling_count4 | -0.07353 | 0.05708 | -1.288 | -0.1854 | 0.03834 | fixed |
| sibling_count5 | -0.1384 | 0.05942 | -2.329 | -0.2549 | -0.02194 | fixed |
| sibling_count5+ | -0.2571 | 0.05173 | -4.97 | -0.3585 | -0.1557 | fixed |
| sd_(Intercept).mother_pidlink | 0.4344 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7502 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.883 | 3.543 | -1.661 | -12.83 | 1.061 | fixed |
| birth_order | 0.006245 | 0.008017 | 0.779 | -0.009468 | 0.02196 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.656 | 0.3686 | 1.78 | -0.06646 | 1.379 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02265 | 0.0126 | -1.797 | -0.04734 | 0.002052 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002539 | 0.0001416 | 1.793 | -0.00002362 | 0.0005315 | fixed |
| male | 0.09972 | 0.02811 | 3.548 | 0.04463 | 0.1548 | fixed |
| sibling_count3 | -0.04529 | 0.05651 | -0.8015 | -0.1561 | 0.06547 | fixed |
| sibling_count4 | -0.08009 | 0.05772 | -1.388 | -0.1932 | 0.03304 | fixed |
| sibling_count5 | -0.1488 | 0.06093 | -2.443 | -0.2683 | -0.02942 | fixed |
| sibling_count5+ | -0.2793 | 0.05906 | -4.729 | -0.3951 | -0.1635 | fixed |
| sd_(Intercept).mother_pidlink | 0.4351 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7499 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.038 | 3.547 | -1.702 | -12.99 | 0.9143 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.6738 | 0.3691 | 1.826 | -0.04963 | 1.397 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02326 | 0.01262 | -1.843 | -0.04799 | 0.001471 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002609 | 0.0001418 | 1.84 | -0.000017 | 0.0005388 | fixed |
| male | 0.09838 | 0.02811 | 3.499 | 0.04327 | 0.1535 | fixed |
| sibling_count3 | -0.04419 | 0.05725 | -0.7718 | -0.1564 | 0.06802 | fixed |
| sibling_count4 | -0.07128 | 0.05925 | -1.203 | -0.1874 | 0.04485 | fixed |
| sibling_count5 | -0.1331 | 0.06322 | -2.105 | -0.257 | -0.009199 | fixed |
| sibling_count5+ | -0.2882 | 0.06054 | -4.76 | -0.4068 | -0.1695 | fixed |
| birth_order_nonlinear2 | -0.01585 | 0.03793 | -0.4179 | -0.09019 | 0.05849 | fixed |
| birth_order_nonlinear3 | 0.002151 | 0.04391 | 0.04899 | -0.08391 | 0.08822 | fixed |
| birth_order_nonlinear4 | -0.02857 | 0.05246 | -0.5446 | -0.1314 | 0.07425 | fixed |
| birth_order_nonlinear5 | -0.02348 | 0.0626 | -0.3751 | -0.1462 | 0.09921 | fixed |
| birth_order_nonlinear5+ | 0.08848 | 0.05961 | 1.484 | -0.02837 | 0.2053 | fixed |
| sd_(Intercept).mother_pidlink | 0.437 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.749 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.25 | 3.558 | -1.757 | -13.22 | 0.7235 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.6961 | 0.3702 | 1.88 | -0.02951 | 1.422 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02407 | 0.01265 | -1.902 | -0.04887 | 0.0007274 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002707 | 0.0001422 | 1.904 | -0.000007981 | 0.0005494 | fixed |
| male | 0.09831 | 0.02817 | 3.49 | 0.0431 | 0.1535 | fixed |
| count_birth_order2/2 | 0.01898 | 0.08003 | 0.2371 | -0.1379 | 0.1758 | fixed |
| count_birth_order1/3 | -0.0516 | 0.07245 | -0.7123 | -0.1936 | 0.09039 | fixed |
| count_birth_order2/3 | 0.01223 | 0.07875 | 0.1553 | -0.1421 | 0.1666 | fixed |
| count_birth_order3/3 | -0.06923 | 0.08565 | -0.8082 | -0.2371 | 0.09865 | fixed |
| count_birth_order1/4 | -0.00921 | 0.08039 | -0.1146 | -0.1668 | 0.1483 | fixed |
| count_birth_order2/4 | -0.1153 | 0.08129 | -1.418 | -0.2746 | 0.04404 | fixed |
| count_birth_order3/4 | -0.1334 | 0.08583 | -1.554 | -0.3016 | 0.03488 | fixed |
| count_birth_order4/4 | -0.01166 | 0.09462 | -0.1233 | -0.1971 | 0.1738 | fixed |
| count_birth_order1/5 | -0.1156 | 0.09221 | -1.254 | -0.2964 | 0.06509 | fixed |
| count_birth_order2/5 | -0.1886 | 0.09582 | -1.968 | -0.3764 | -0.0008033 | fixed |
| count_birth_order3/5 | -0.03245 | 0.09584 | -0.3386 | -0.2203 | 0.1554 | fixed |
| count_birth_order4/5 | -0.2382 | 0.09614 | -2.478 | -0.4267 | -0.04981 | fixed |
| count_birth_order5/5 | -0.09026 | 0.09993 | -0.9032 | -0.2861 | 0.1056 | fixed |
| count_birth_order1/5+ | -0.2836 | 0.08558 | -3.314 | -0.4514 | -0.1159 | fixed |
| count_birth_order2/5+ | -0.3124 | 0.08718 | -3.583 | -0.4833 | -0.1415 | fixed |
| count_birth_order3/5+ | -0.2233 | 0.08297 | -2.692 | -0.3859 | -0.06071 | fixed |
| count_birth_order4/5+ | -0.3001 | 0.08217 | -3.653 | -0.4612 | -0.1391 | fixed |
| count_birth_order5/5+ | -0.3303 | 0.08399 | -3.933 | -0.4949 | -0.1657 | fixed |
| count_birth_order5+/5+ | -0.1878 | 0.06719 | -2.795 | -0.3195 | -0.0561 | fixed |
| sd_(Intercept).mother_pidlink | 0.4372 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7489 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 9142 | 9210 | -4560 | 9120 | NA | NA | NA |
| 12 | 9143 | 9217 | -4560 | 9119 | 0.6053 | 1 | 0.4366 |
| 16 | 9147 | 9246 | -4558 | 9115 | 4.017 | 4 | 0.4037 |
| 26 | 9157 | 9318 | -4552 | 9105 | 10.13 | 10 | 0.4292 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.585 | 3.572 | -1.843 | -13.59 | 0.4161 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7268 | 0.3715 | 1.956 | -0.001401 | 1.455 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02503 | 0.01269 | -1.971 | -0.04991 | -0.0001444 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00028 | 0.0001426 | 1.963 | 0.0000004695 | 0.0005594 | fixed |
| male | 0.0975 | 0.02838 | 3.435 | 0.04187 | 0.1531 | fixed |
| sibling_count3 | 0.0009891 | 0.05023 | 0.01969 | -0.09747 | 0.09945 | fixed |
| sibling_count4 | -0.07573 | 0.0521 | -1.454 | -0.1778 | 0.02638 | fixed |
| sibling_count5 | -0.1448 | 0.05821 | -2.489 | -0.2589 | -0.03077 | fixed |
| sibling_count5+ | -0.2645 | 0.04975 | -5.316 | -0.362 | -0.167 | fixed |
| sd_(Intercept).mother_pidlink | 0.4376 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7484 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.765 | 3.572 | -1.894 | -13.77 | 0.2352 | fixed |
| birth_order | 0.01577 | 0.009347 | 1.687 | -0.002547 | 0.03409 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7427 | 0.3715 | 1.999 | 0.01464 | 1.471 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02558 | 0.01269 | -2.016 | -0.05046 | -0.0007059 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002869 | 0.0001426 | 2.012 | 0.000007389 | 0.0005663 | fixed |
| male | 0.09624 | 0.02838 | 3.391 | 0.04062 | 0.1519 | fixed |
| sibling_count3 | -0.006248 | 0.05042 | -0.1239 | -0.1051 | 0.09258 | fixed |
| sibling_count4 | -0.09368 | 0.05318 | -1.761 | -0.1979 | 0.01056 | fixed |
| sibling_count5 | -0.173 | 0.06055 | -2.856 | -0.2916 | -0.05428 | fixed |
| sibling_count5+ | -0.3216 | 0.06016 | -5.346 | -0.4395 | -0.2037 | fixed |
| sd_(Intercept).mother_pidlink | 0.4387 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7476 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.133 | 3.572 | -1.997 | -14.13 | -0.1313 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7832 | 0.3715 | 2.108 | 0.055 | 1.511 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02698 | 0.0127 | -2.126 | -0.05187 | -0.002102 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003029 | 0.0001426 | 2.124 | 0.00002336 | 0.0005824 | fixed |
| male | 0.09676 | 0.02835 | 3.413 | 0.0412 | 0.1523 | fixed |
| sibling_count3 | -0.01456 | 0.05114 | -0.2848 | -0.1148 | 0.08568 | fixed |
| sibling_count4 | -0.09135 | 0.05505 | -1.659 | -0.1992 | 0.01655 | fixed |
| sibling_count5 | -0.1603 | 0.06309 | -2.541 | -0.284 | -0.03666 | fixed |
| sibling_count5+ | -0.3484 | 0.06163 | -5.652 | -0.4692 | -0.2276 | fixed |
| birth_order_nonlinear2 | 0.005591 | 0.03694 | 0.1513 | -0.06682 | 0.078 | fixed |
| birth_order_nonlinear3 | 0.06332 | 0.04377 | 1.446 | -0.02248 | 0.1491 | fixed |
| birth_order_nonlinear4 | -0.009146 | 0.05455 | -0.1677 | -0.1161 | 0.09776 | fixed |
| birth_order_nonlinear5 | 0.00588 | 0.06736 | 0.08729 | -0.1261 | 0.1379 | fixed |
| birth_order_nonlinear5+ | 0.1927 | 0.06732 | 2.862 | 0.06073 | 0.3246 | fixed |
| sd_(Intercept).mother_pidlink | 0.4399 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7463 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.193 | 3.574 | -2.013 | -14.2 | -0.1878 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7935 | 0.3717 | 2.134 | 0.06486 | 1.522 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02739 | 0.0127 | -2.156 | -0.05229 | -0.002496 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003081 | 0.0001427 | 2.159 | 0.0000284 | 0.0005877 | fixed |
| male | 0.0977 | 0.02838 | 3.442 | 0.04207 | 0.1533 | fixed |
| count_birth_order2/2 | -0.05581 | 0.06848 | -0.815 | -0.19 | 0.0784 | fixed |
| count_birth_order1/3 | -0.04644 | 0.06417 | -0.7237 | -0.1722 | 0.07932 | fixed |
| count_birth_order2/3 | 0.01644 | 0.071 | 0.2316 | -0.1227 | 0.1556 | fixed |
| count_birth_order3/3 | -0.01701 | 0.07702 | -0.2208 | -0.168 | 0.1339 | fixed |
| count_birth_order1/4 | -0.09631 | 0.07556 | -1.275 | -0.2444 | 0.05178 | fixed |
| count_birth_order2/4 | -0.1318 | 0.0772 | -1.708 | -0.2831 | 0.01948 | fixed |
| count_birth_order3/4 | -0.09476 | 0.0785 | -1.207 | -0.2486 | 0.05911 | fixed |
| count_birth_order4/4 | -0.068 | 0.08417 | -0.8078 | -0.233 | 0.09698 | fixed |
| count_birth_order1/5 | -0.2536 | 0.0969 | -2.617 | -0.4435 | -0.06366 | fixed |
| count_birth_order2/5 | -0.3178 | 0.1027 | -3.096 | -0.5191 | -0.1166 | fixed |
| count_birth_order3/5 | 0.04751 | 0.09371 | 0.507 | -0.1362 | 0.2312 | fixed |
| count_birth_order4/5 | -0.2302 | 0.09418 | -2.444 | -0.4148 | -0.04563 | fixed |
| count_birth_order5/5 | -0.1075 | 0.1022 | -1.051 | -0.3078 | 0.09286 | fixed |
| count_birth_order1/5+ | -0.3875 | 0.09583 | -4.044 | -0.5753 | -0.1997 | fixed |
| count_birth_order2/5+ | -0.2473 | 0.09394 | -2.633 | -0.4314 | -0.06318 | fixed |
| count_birth_order3/5+ | -0.3206 | 0.08569 | -3.741 | -0.4885 | -0.1526 | fixed |
| count_birth_order4/5+ | -0.4067 | 0.08779 | -4.633 | -0.5788 | -0.2347 | fixed |
| count_birth_order5/5+ | -0.4028 | 0.08341 | -4.83 | -0.5663 | -0.2394 | fixed |
| count_birth_order5+/5+ | -0.1803 | 0.06577 | -2.742 | -0.3092 | -0.05144 | fixed |
| sd_(Intercept).mother_pidlink | 0.4408 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7452 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 8931 | 8999 | -4454 | 8909 | NA | NA | NA |
| 12 | 8930 | 9004 | -4453 | 8906 | 2.848 | 1 | 0.09148 |
| 16 | 8928 | 9027 | -4448 | 8896 | 9.558 | 4 | 0.04856 |
| 26 | 8933 | 9093 | -4440 | 8881 | 15.3 | 10 | 0.1215 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = math_2007_old)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.1 | 1.962 | -2.599 | -8.946 | -1.254 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.6087 | 0.2039 | 2.985 | 0.209 | 1.008 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02176 | 0.006973 | -3.12 | -0.03543 | -0.00809 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002442 | 0.00007845 | 3.114 | 0.00009049 | 0.000398 | fixed |
| male | -0.1091 | 0.02082 | -5.241 | -0.1499 | -0.06829 | fixed |
| sibling_count3 | 0.03799 | 0.05713 | 0.6651 | -0.07397 | 0.15 | fixed |
| sibling_count4 | -0.1154 | 0.0559 | -2.065 | -0.225 | -0.00586 | fixed |
| sibling_count5 | -0.0517 | 0.05682 | -0.9099 | -0.1631 | 0.05967 | fixed |
| sibling_count5+ | -0.2327 | 0.0467 | -4.983 | -0.3243 | -0.1412 | fixed |
| sd_(Intercept).mother_pidlink | 0.5578 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8105 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.077 | 1.963 | -2.587 | -8.924 | -1.231 | fixed |
| birth_order | -0.002346 | 0.004368 | -0.5372 | -0.01091 | 0.006214 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.6072 | 0.204 | 2.977 | 0.2074 | 1.007 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02171 | 0.006974 | -3.113 | -0.03538 | -0.008042 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002436 | 0.00007846 | 3.105 | 0.00008987 | 0.0003974 | fixed |
| male | -0.1089 | 0.02082 | -5.233 | -0.1497 | -0.06813 | fixed |
| sibling_count3 | 0.03898 | 0.05716 | 0.682 | -0.07304 | 0.151 | fixed |
| sibling_count4 | -0.1133 | 0.05603 | -2.023 | -0.2231 | -0.003524 | fixed |
| sibling_count5 | -0.0482 | 0.05719 | -0.8428 | -0.1603 | 0.06389 | fixed |
| sibling_count5+ | -0.2235 | 0.04977 | -4.49 | -0.321 | -0.1259 | fixed |
| sd_(Intercept).mother_pidlink | 0.5576 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8106 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.042 | 1.964 | -2.567 | -8.892 | -1.192 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.6034 | 0.2042 | 2.955 | 0.2032 | 1.004 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02158 | 0.006981 | -3.091 | -0.03526 | -0.007896 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002423 | 0.00007853 | 3.086 | 0.0000884 | 0.0003962 | fixed |
| male | -0.1088 | 0.02083 | -5.225 | -0.1497 | -0.06801 | fixed |
| sibling_count3 | 0.04522 | 0.05794 | 0.7805 | -0.06835 | 0.1588 | fixed |
| sibling_count4 | -0.1125 | 0.05717 | -1.968 | -0.2245 | -0.0004324 | fixed |
| sibling_count5 | -0.0471 | 0.0588 | -0.801 | -0.1623 | 0.06814 | fixed |
| sibling_count5+ | -0.2317 | 0.05131 | -4.515 | -0.3322 | -0.1311 | fixed |
| birth_order_nonlinear2 | -0.01638 | 0.03294 | -0.4972 | -0.08093 | 0.04818 | fixed |
| birth_order_nonlinear3 | -0.03209 | 0.03544 | -0.9054 | -0.1016 | 0.03738 | fixed |
| birth_order_nonlinear4 | 0.003617 | 0.03882 | 0.09317 | -0.07248 | 0.07971 | fixed |
| birth_order_nonlinear5 | -0.01445 | 0.04397 | -0.3287 | -0.1006 | 0.07172 | fixed |
| birth_order_nonlinear5+ | -0.004172 | 0.03781 | -0.1103 | -0.07828 | 0.06994 | fixed |
| sd_(Intercept).mother_pidlink | 0.5579 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8107 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.086 | 1.967 | -2.586 | -8.941 | -1.231 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.6108 | 0.2044 | 2.988 | 0.2102 | 1.011 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02183 | 0.006989 | -3.124 | -0.03553 | -0.008132 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002452 | 0.00007861 | 3.119 | 0.00009108 | 0.0003992 | fixed |
| male | -0.1091 | 0.02085 | -5.235 | -0.15 | -0.06828 | fixed |
| count_birth_order2/2 | -0.08004 | 0.07646 | -1.047 | -0.2299 | 0.06981 | fixed |
| count_birth_order1/3 | 0.00667 | 0.07716 | 0.08644 | -0.1446 | 0.1579 | fixed |
| count_birth_order2/3 | 0.04806 | 0.08229 | 0.5841 | -0.1132 | 0.2094 | fixed |
| count_birth_order3/3 | -0.04683 | 0.08257 | -0.5672 | -0.2087 | 0.115 | fixed |
| count_birth_order1/4 | -0.1732 | 0.07947 | -2.179 | -0.3289 | -0.01741 | fixed |
| count_birth_order2/4 | -0.133 | 0.08273 | -1.607 | -0.2951 | 0.02917 | fixed |
| count_birth_order3/4 | -0.2135 | 0.0851 | -2.509 | -0.3803 | -0.04674 | fixed |
| count_birth_order4/4 | -0.08108 | 0.08588 | -0.9441 | -0.2494 | 0.08724 | fixed |
| count_birth_order1/5 | -0.06339 | 0.08697 | -0.7288 | -0.2338 | 0.1071 | fixed |
| count_birth_order2/5 | -0.1507 | 0.08848 | -1.703 | -0.3241 | 0.02274 | fixed |
| count_birth_order3/5 | -0.08961 | 0.08732 | -1.026 | -0.2607 | 0.08153 | fixed |
| count_birth_order4/5 | -0.1034 | 0.08935 | -1.157 | -0.2785 | 0.07172 | fixed |
| count_birth_order5/5 | -0.02592 | 0.09116 | -0.2843 | -0.2046 | 0.1527 | fixed |
| count_birth_order1/5+ | -0.258 | 0.0695 | -3.712 | -0.3942 | -0.1218 | fixed |
| count_birth_order2/5+ | -0.2725 | 0.06994 | -3.896 | -0.4095 | -0.1354 | fixed |
| count_birth_order3/5+ | -0.2665 | 0.06871 | -3.879 | -0.4012 | -0.1318 | fixed |
| count_birth_order4/5+ | -0.2656 | 0.06748 | -3.937 | -0.3979 | -0.1334 | fixed |
| count_birth_order5/5+ | -0.2939 | 0.06828 | -4.304 | -0.4277 | -0.1601 | fixed |
| count_birth_order5+/5+ | -0.2644 | 0.05998 | -4.408 | -0.382 | -0.1468 | fixed |
| sd_(Intercept).mother_pidlink | 0.5574 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8111 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 21998 | 22075 | -10988 | 21976 | NA | NA | NA |
| 12 | 22000 | 22084 | -10988 | 21976 | 0.2897 | 1 | 0.5904 |
| 16 | 22007 | 22119 | -10988 | 21975 | 0.9632 | 4 | 0.9153 |
| 26 | 22021 | 22203 | -10984 | 21969 | 6.232 | 10 | 0.7954 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -4.127 | 4.008 | -1.03 | -11.98 | 3.729 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5153 | 0.417 | 1.236 | -0.302 | 1.333 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01842 | 0.01425 | -1.292 | -0.04636 | 0.009517 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002076 | 0.0001602 | 1.296 | -0.0001064 | 0.0005215 | fixed |
| male | -0.1656 | 0.0319 | -5.192 | -0.2281 | -0.1031 | fixed |
| sibling_count3 | 0.02809 | 0.0588 | 0.4777 | -0.08715 | 0.1433 | fixed |
| sibling_count4 | -0.04592 | 0.06077 | -0.7557 | -0.165 | 0.07318 | fixed |
| sibling_count5 | -0.1236 | 0.06645 | -1.86 | -0.2539 | 0.006609 | fixed |
| sibling_count5+ | -0.268 | 0.05746 | -4.664 | -0.3806 | -0.1554 | fixed |
| sd_(Intercept).mother_pidlink | 0.5375 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8326 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -4.343 | 4.008 | -1.084 | -12.2 | 3.512 | fixed |
| birth_order | 0.02037 | 0.01042 | 1.954 | -0.00006569 | 0.0408 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5341 | 0.417 | 1.281 | -0.2832 | 1.351 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01908 | 0.01425 | -1.338 | -0.04701 | 0.008858 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002158 | 0.0001602 | 1.347 | -0.00009812 | 0.0005297 | fixed |
| male | -0.1676 | 0.0319 | -5.254 | -0.2301 | -0.1051 | fixed |
| sibling_count3 | 0.01892 | 0.05896 | 0.3209 | -0.09664 | 0.1345 | fixed |
| sibling_count4 | -0.06944 | 0.06192 | -1.121 | -0.1908 | 0.05193 | fixed |
| sibling_count5 | -0.162 | 0.06927 | -2.339 | -0.2978 | -0.02625 | fixed |
| sibling_count5+ | -0.3421 | 0.06883 | -4.97 | -0.477 | -0.2072 | fixed |
| sd_(Intercept).mother_pidlink | 0.5372 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8323 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -4.234 | 4.016 | -1.054 | -12.11 | 3.638 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5252 | 0.4179 | 1.257 | -0.2938 | 1.344 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01878 | 0.01428 | -1.315 | -0.04678 | 0.009209 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002127 | 0.0001605 | 1.325 | -0.0001019 | 0.0005272 | fixed |
| male | -0.1671 | 0.03191 | -5.237 | -0.2297 | -0.1046 | fixed |
| sibling_count3 | 0.01475 | 0.05971 | 0.2471 | -0.1023 | 0.1318 | fixed |
| sibling_count4 | -0.08506 | 0.06395 | -1.33 | -0.2104 | 0.04028 | fixed |
| sibling_count5 | -0.1773 | 0.0723 | -2.452 | -0.319 | -0.03557 | fixed |
| sibling_count5+ | -0.3553 | 0.07036 | -5.05 | -0.4932 | -0.2174 | fixed |
| birth_order_nonlinear2 | 0.01388 | 0.04185 | 0.3317 | -0.06814 | 0.0959 | fixed |
| birth_order_nonlinear3 | 0.05777 | 0.04965 | 1.164 | -0.03954 | 0.1551 | fixed |
| birth_order_nonlinear4 | 0.1137 | 0.06092 | 1.867 | -0.005655 | 0.2332 | fixed |
| birth_order_nonlinear5 | 0.07464 | 0.07384 | 1.011 | -0.07009 | 0.2194 | fixed |
| birth_order_nonlinear5+ | 0.1402 | 0.07456 | 1.88 | -0.005951 | 0.2863 | fixed |
| sd_(Intercept).mother_pidlink | 0.5365 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8329 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -4.353 | 4.016 | -1.084 | -12.22 | 3.518 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5416 | 0.4178 | 1.296 | -0.2772 | 1.36 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01934 | 0.01428 | -1.354 | -0.04733 | 0.00865 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002189 | 0.0001605 | 1.364 | -0.00009562 | 0.0005334 | fixed |
| male | -0.1694 | 0.03192 | -5.307 | -0.2319 | -0.1068 | fixed |
| count_birth_order2/2 | -0.1002 | 0.07959 | -1.259 | -0.2562 | 0.0558 | fixed |
| count_birth_order1/3 | -0.02078 | 0.07425 | -0.2798 | -0.1663 | 0.1247 | fixed |
| count_birth_order2/3 | -0.03022 | 0.08127 | -0.3718 | -0.1895 | 0.1291 | fixed |
| count_birth_order3/3 | 0.04444 | 0.09002 | 0.4936 | -0.132 | 0.2209 | fixed |
| count_birth_order1/4 | -0.1305 | 0.08648 | -1.509 | -0.3 | 0.03902 | fixed |
| count_birth_order2/4 | -0.08433 | 0.08829 | -0.9552 | -0.2574 | 0.08871 | fixed |
| count_birth_order3/4 | -0.1842 | 0.08944 | -2.06 | -0.3595 | -0.008904 | fixed |
| count_birth_order4/4 | 0.09782 | 0.09722 | 1.006 | -0.09272 | 0.2884 | fixed |
| count_birth_order1/5 | -0.2027 | 0.1116 | -1.817 | -0.4214 | 0.016 | fixed |
| count_birth_order2/5 | -0.2693 | 0.1155 | -2.331 | -0.4957 | -0.04286 | fixed |
| count_birth_order3/5 | -0.06099 | 0.1052 | -0.5797 | -0.2672 | 0.1452 | fixed |
| count_birth_order4/5 | -0.143 | 0.1047 | -1.366 | -0.3482 | 0.0622 | fixed |
| count_birth_order5/5 | -0.1681 | 0.1096 | -1.534 | -0.3829 | 0.04671 | fixed |
| count_birth_order1/5+ | -0.5594 | 0.1064 | -5.259 | -0.7679 | -0.3509 | fixed |
| count_birth_order2/5+ | -0.2231 | 0.1032 | -2.162 | -0.4254 | -0.02086 | fixed |
| count_birth_order3/5+ | -0.2829 | 0.09714 | -2.912 | -0.4733 | -0.09253 | fixed |
| count_birth_order4/5+ | -0.3577 | 0.09658 | -3.704 | -0.547 | -0.1684 | fixed |
| count_birth_order5/5+ | -0.3057 | 0.09391 | -3.255 | -0.4898 | -0.1217 | fixed |
| count_birth_order5+/5+ | -0.257 | 0.07455 | -3.447 | -0.4031 | -0.1109 | fixed |
| sd_(Intercept).mother_pidlink | 0.5403 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8298 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 9998 | 10066 | -4988 | 9976 | NA | NA | NA |
| 12 | 9996 | 10071 | -4986 | 9972 | 3.826 | 1 | 0.05046 |
| 16 | 10003 | 10102 | -4985 | 9971 | 1.676 | 4 | 0.7951 |
| 26 | 10004 | 10165 | -4976 | 9952 | 18.3 | 10 | 0.05009 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -4.371 | 4.006 | -1.091 | -12.22 | 3.481 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.542 | 0.4168 | 1.3 | -0.275 | 1.359 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01939 | 0.01425 | -1.361 | -0.04731 | 0.008538 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002186 | 0.0001601 | 1.365 | -0.0000952 | 0.0005324 | fixed |
| male | -0.1633 | 0.03187 | -5.124 | -0.2258 | -0.1008 | fixed |
| sibling_count3 | 0.0165 | 0.06515 | 0.2532 | -0.1112 | 0.1442 | fixed |
| sibling_count4 | -0.03107 | 0.06602 | -0.4706 | -0.1605 | 0.09832 | fixed |
| sibling_count5 | -0.05786 | 0.06883 | -0.8406 | -0.1928 | 0.07704 | fixed |
| sibling_count5+ | -0.1946 | 0.05987 | -3.25 | -0.3119 | -0.07722 | fixed |
| sd_(Intercept).mother_pidlink | 0.5427 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8324 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -4.479 | 4.007 | -1.118 | -12.33 | 3.375 | fixed |
| birth_order | 0.008948 | 0.009208 | 0.9718 | -0.009099 | 0.027 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5518 | 0.417 | 1.323 | -0.2654 | 1.369 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01974 | 0.01425 | -1.385 | -0.04767 | 0.008196 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000223 | 0.0001602 | 1.392 | -0.00009093 | 0.0005369 | fixed |
| male | -0.1641 | 0.03188 | -5.147 | -0.2266 | -0.1016 | fixed |
| sibling_count3 | 0.01225 | 0.06531 | 0.1876 | -0.1157 | 0.1402 | fixed |
| sibling_count4 | -0.04063 | 0.06675 | -0.6087 | -0.1715 | 0.09019 | fixed |
| sibling_count5 | -0.073 | 0.07058 | -1.034 | -0.2113 | 0.06533 | fixed |
| sibling_count5+ | -0.2265 | 0.06829 | -3.316 | -0.3603 | -0.09263 | fixed |
| sd_(Intercept).mother_pidlink | 0.543 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8323 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -4.65 | 4.016 | -1.158 | -12.52 | 3.221 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5695 | 0.4178 | 1.363 | -0.2494 | 1.388 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02033 | 0.01428 | -1.424 | -0.04832 | 0.007657 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002296 | 0.0001605 | 1.431 | -0.0000849 | 0.0005441 | fixed |
| male | -0.1645 | 0.0319 | -5.156 | -0.227 | -0.102 | fixed |
| sibling_count3 | 0.00755 | 0.0661 | 0.1142 | -0.122 | 0.1371 | fixed |
| sibling_count4 | -0.05017 | 0.06842 | -0.7333 | -0.1843 | 0.08393 | fixed |
| sibling_count5 | -0.07514 | 0.07309 | -1.028 | -0.2184 | 0.06812 | fixed |
| sibling_count5+ | -0.2374 | 0.06988 | -3.398 | -0.3744 | -0.1005 | fixed |
| birth_order_nonlinear2 | 0.02522 | 0.04284 | 0.5888 | -0.05874 | 0.1092 | fixed |
| birth_order_nonlinear3 | 0.04141 | 0.04964 | 0.8342 | -0.05589 | 0.1387 | fixed |
| birth_order_nonlinear4 | 0.05611 | 0.05947 | 0.9435 | -0.06045 | 0.1727 | fixed |
| birth_order_nonlinear5 | 0.003816 | 0.07089 | 0.05383 | -0.1351 | 0.1428 | fixed |
| birth_order_nonlinear5+ | 0.09122 | 0.06817 | 1.338 | -0.04239 | 0.2248 | fixed |
| sd_(Intercept).mother_pidlink | 0.5431 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8326 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.133 | 4.028 | -1.274 | -13.03 | 2.762 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.6228 | 0.4191 | 1.486 | -0.1986 | 1.444 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02212 | 0.01432 | -1.544 | -0.05019 | 0.005953 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002494 | 0.0001609 | 1.55 | -0.00006603 | 0.0005648 | fixed |
| male | -0.1678 | 0.03197 | -5.248 | -0.2304 | -0.1051 | fixed |
| count_birth_order2/2 | -0.08389 | 0.09032 | -0.9288 | -0.2609 | 0.09314 | fixed |
| count_birth_order1/3 | -0.05503 | 0.08281 | -0.6645 | -0.2173 | 0.1073 | fixed |
| count_birth_order2/3 | -0.004886 | 0.08999 | -0.05429 | -0.1813 | 0.1715 | fixed |
| count_birth_order3/3 | 0.05245 | 0.09768 | 0.5369 | -0.139 | 0.2439 | fixed |
| count_birth_order1/4 | -0.09204 | 0.0918 | -1.003 | -0.272 | 0.08788 | fixed |
| count_birth_order2/4 | -0.02352 | 0.09274 | -0.2537 | -0.2053 | 0.1582 | fixed |
| count_birth_order3/4 | -0.1511 | 0.0978 | -1.546 | -0.3428 | 0.04053 | fixed |
| count_birth_order4/4 | 0.03295 | 0.1078 | 0.3057 | -0.1783 | 0.2443 | fixed |
| count_birth_order1/5 | -0.09179 | 0.1055 | -0.8701 | -0.2985 | 0.115 | fixed |
| count_birth_order2/5 | -0.09788 | 0.1095 | -0.8938 | -0.3125 | 0.1168 | fixed |
| count_birth_order3/5 | -0.127 | 0.1091 | -1.164 | -0.3409 | 0.08683 | fixed |
| count_birth_order4/5 | -0.1385 | 0.1098 | -1.262 | -0.3537 | 0.07666 | fixed |
| count_birth_order5/5 | 0.007127 | 0.1138 | 0.06262 | -0.2159 | 0.2302 | fixed |
| count_birth_order1/5+ | -0.3253 | 0.09756 | -3.334 | -0.5165 | -0.1341 | fixed |
| count_birth_order2/5+ | -0.2307 | 0.09925 | -2.325 | -0.4252 | -0.03618 | fixed |
| count_birth_order3/5+ | -0.1457 | 0.09446 | -1.542 | -0.3308 | 0.03948 | fixed |
| count_birth_order4/5+ | -0.2183 | 0.09352 | -2.334 | -0.4016 | -0.03499 | fixed |
| count_birth_order5/5+ | -0.3437 | 0.09551 | -3.599 | -0.5309 | -0.1565 | fixed |
| count_birth_order5+/5+ | -0.1877 | 0.07701 | -2.437 | -0.3387 | -0.03677 | fixed |
| sd_(Intercept).mother_pidlink | 0.5425 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8327 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 10073 | 10141 | -5026 | 10051 | NA | NA | NA |
| 12 | 10074 | 10149 | -5025 | 10050 | 0.9464 | 1 | 0.3306 |
| 16 | 10081 | 10180 | -5024 | 10049 | 1.653 | 4 | 0.7992 |
| 26 | 10089 | 10250 | -5019 | 10037 | 11.21 | 10 | 0.3414 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -4.667 | 4.039 | -1.156 | -12.58 | 3.249 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5704 | 0.42 | 1.358 | -0.2529 | 1.394 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02031 | 0.01435 | -1.415 | -0.04844 | 0.007817 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002285 | 0.0001612 | 1.418 | -0.00008744 | 0.0005445 | fixed |
| male | -0.172 | 0.03217 | -5.347 | -0.235 | -0.1089 | fixed |
| sibling_count3 | 0.04253 | 0.05789 | 0.7347 | -0.07093 | 0.156 | fixed |
| sibling_count4 | -0.00362 | 0.06007 | -0.06026 | -0.1213 | 0.1141 | fixed |
| sibling_count5 | -0.08955 | 0.06729 | -1.331 | -0.2214 | 0.04234 | fixed |
| sibling_count5+ | -0.2283 | 0.05746 | -3.972 | -0.3409 | -0.1156 | fixed |
| sd_(Intercept).mother_pidlink | 0.5385 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8325 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -4.89 | 4.039 | -1.211 | -12.81 | 3.027 | fixed |
| birth_order | 0.01969 | 0.01069 | 1.842 | -0.001265 | 0.04065 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5898 | 0.42 | 1.404 | -0.2335 | 1.413 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02099 | 0.01435 | -1.462 | -0.04912 | 0.00714 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002369 | 0.0001612 | 1.47 | -0.00007906 | 0.0005529 | fixed |
| male | -0.1735 | 0.03217 | -5.394 | -0.2366 | -0.1105 | fixed |
| sibling_count3 | 0.03345 | 0.05807 | 0.576 | -0.08038 | 0.1473 | fixed |
| sibling_count4 | -0.02628 | 0.06129 | -0.4288 | -0.1464 | 0.09385 | fixed |
| sibling_count5 | -0.125 | 0.06996 | -1.786 | -0.2621 | 0.01215 | fixed |
| sibling_count5+ | -0.2998 | 0.06933 | -4.324 | -0.4357 | -0.1639 | fixed |
| sd_(Intercept).mother_pidlink | 0.5383 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8323 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -4.722 | 4.046 | -1.167 | -12.65 | 3.208 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5745 | 0.4208 | 1.365 | -0.2502 | 1.399 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02048 | 0.01438 | -1.424 | -0.04865 | 0.007704 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002313 | 0.0001615 | 1.432 | -0.0000852 | 0.0005478 | fixed |
| male | -0.173 | 0.03218 | -5.378 | -0.2361 | -0.11 | fixed |
| sibling_count3 | 0.03542 | 0.05889 | 0.6013 | -0.08001 | 0.1508 | fixed |
| sibling_count4 | -0.03158 | 0.06339 | -0.4983 | -0.1558 | 0.09266 | fixed |
| sibling_count5 | -0.1308 | 0.07281 | -1.797 | -0.2735 | 0.0119 | fixed |
| sibling_count5+ | -0.3123 | 0.07097 | -4.4 | -0.4514 | -0.1732 | fixed |
| birth_order_nonlinear2 | 0.01662 | 0.04175 | 0.3981 | -0.06521 | 0.09844 | fixed |
| birth_order_nonlinear3 | 0.02904 | 0.04951 | 0.5866 | -0.068 | 0.1261 | fixed |
| birth_order_nonlinear4 | 0.09316 | 0.06189 | 1.505 | -0.02814 | 0.2145 | fixed |
| birth_order_nonlinear5 | 0.07755 | 0.07635 | 1.016 | -0.0721 | 0.2272 | fixed |
| birth_order_nonlinear5+ | 0.1508 | 0.07683 | 1.962 | 0.000189 | 0.3014 | fixed |
| sd_(Intercept).mother_pidlink | 0.5379 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8329 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -4.752 | 4.051 | -1.173 | -12.69 | 3.188 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.5826 | 0.4213 | 1.383 | -0.2431 | 1.408 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02079 | 0.01439 | -1.445 | -0.04901 | 0.007415 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002354 | 0.0001617 | 1.456 | -0.00008143 | 0.0005523 | fixed |
| male | -0.1735 | 0.03224 | -5.382 | -0.2367 | -0.1103 | fixed |
| count_birth_order2/2 | -0.08293 | 0.07738 | -1.072 | -0.2346 | 0.06873 | fixed |
| count_birth_order1/3 | -0.004316 | 0.07332 | -0.05886 | -0.148 | 0.1394 | fixed |
| count_birth_order2/3 | 0.0333 | 0.08109 | 0.4107 | -0.1256 | 0.1922 | fixed |
| count_birth_order3/3 | 0.01099 | 0.0878 | 0.1252 | -0.1611 | 0.1831 | fixed |
| count_birth_order1/4 | -0.05723 | 0.08623 | -0.6637 | -0.2262 | 0.1118 | fixed |
| count_birth_order2/4 | -0.02736 | 0.088 | -0.3109 | -0.1998 | 0.1451 | fixed |
| count_birth_order3/4 | -0.1187 | 0.08945 | -1.327 | -0.294 | 0.05662 | fixed |
| count_birth_order4/4 | 0.06962 | 0.09595 | 0.7256 | -0.1184 | 0.2577 | fixed |
| count_birth_order1/5 | -0.1861 | 0.1109 | -1.678 | -0.4035 | 0.03122 | fixed |
| count_birth_order2/5 | -0.2571 | 0.1174 | -2.19 | -0.4873 | -0.02698 | fixed |
| count_birth_order3/5 | -0.0593 | 0.1067 | -0.5557 | -0.2684 | 0.1498 | fixed |
| count_birth_order4/5 | -0.08314 | 0.1076 | -0.7725 | -0.2941 | 0.1278 | fixed |
| count_birth_order5/5 | -0.04927 | 0.1164 | -0.4234 | -0.2773 | 0.1788 | fixed |
| count_birth_order1/5+ | -0.4789 | 0.109 | -4.393 | -0.6926 | -0.2652 | fixed |
| count_birth_order2/5+ | -0.208 | 0.1068 | -1.946 | -0.4174 | 0.001458 | fixed |
| count_birth_order3/5+ | -0.2551 | 0.0975 | -2.616 | -0.4462 | -0.06399 | fixed |
| count_birth_order4/5+ | -0.2976 | 0.09981 | -2.982 | -0.4932 | -0.102 | fixed |
| count_birth_order5/5+ | -0.2926 | 0.09505 | -3.078 | -0.4789 | -0.1063 | fixed |
| count_birth_order5+/5+ | -0.1995 | 0.07533 | -2.648 | -0.3472 | -0.05186 | fixed |
| sd_(Intercept).mother_pidlink | 0.5395 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8319 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 9830 | 9898 | -4904 | 9808 | NA | NA | NA |
| 12 | 9829 | 9903 | -4903 | 9805 | 3.4 | 1 | 0.06519 |
| 16 | 9836 | 9934 | -4902 | 9804 | 1.376 | 4 | 0.8484 |
| 26 | 9845 | 10005 | -4896 | 9793 | 11 | 10 | 0.3572 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = raven_2007_young)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.538 | 0.4647 | -14.07 | -7.449 | -5.628 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7174 | 0.06304 | 11.38 | 0.5939 | 0.841 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02329 | 0.00279 | -8.346 | -0.02876 | -0.01782 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002269 | 0.00004068 | 5.579 | 0.0001472 | 0.0003067 | fixed |
| male | 0.04906 | 0.01897 | 2.586 | 0.01188 | 0.08624 | fixed |
| sibling_count3 | -0.02344 | 0.04132 | -0.5672 | -0.1044 | 0.05754 | fixed |
| sibling_count4 | -0.1274 | 0.04218 | -3.02 | -0.21 | -0.04471 | fixed |
| sibling_count5 | -0.1396 | 0.04548 | -3.07 | -0.2288 | -0.05048 | fixed |
| sibling_count5+ | -0.3188 | 0.03645 | -8.748 | -0.3903 | -0.2474 | fixed |
| sd_(Intercept).mother_pidlink | 0.5465 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7892 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.539 | 0.4647 | -14.07 | -7.45 | -5.628 | fixed |
| birth_order | -0.0008314 | 0.004314 | -0.1927 | -0.009287 | 0.007625 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7178 | 0.06307 | 11.38 | 0.5942 | 0.8414 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02331 | 0.002792 | -8.348 | -0.02878 | -0.01783 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002271 | 0.00004069 | 5.582 | 0.0001474 | 0.0003069 | fixed |
| male | 0.04913 | 0.01897 | 2.589 | 0.01194 | 0.08631 | fixed |
| sibling_count3 | -0.02302 | 0.04138 | -0.5563 | -0.1041 | 0.05808 | fixed |
| sibling_count4 | -0.1264 | 0.04246 | -2.978 | -0.2096 | -0.04322 | fixed |
| sibling_count5 | -0.1381 | 0.0462 | -2.988 | -0.2286 | -0.04751 | fixed |
| sibling_count5+ | -0.3144 | 0.04308 | -7.298 | -0.3988 | -0.23 | fixed |
| sd_(Intercept).mother_pidlink | 0.5466 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7893 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.59 | 0.4654 | -14.16 | -7.502 | -5.678 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7218 | 0.06309 | 11.44 | 0.5981 | 0.8454 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02346 | 0.002792 | -8.403 | -0.02894 | -0.01799 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002291 | 0.00004069 | 5.63 | 0.0001494 | 0.0003089 | fixed |
| male | 0.04929 | 0.01897 | 2.598 | 0.01211 | 0.08648 | fixed |
| sibling_count3 | -0.02145 | 0.04194 | -0.5114 | -0.1036 | 0.06075 | fixed |
| sibling_count4 | -0.1281 | 0.04391 | -2.917 | -0.2142 | -0.04204 | fixed |
| sibling_count5 | -0.1345 | 0.04857 | -2.769 | -0.2297 | -0.03927 | fixed |
| sibling_count5+ | -0.3092 | 0.04591 | -6.733 | -0.3991 | -0.2192 | fixed |
| birth_order_nonlinear2 | 0.06258 | 0.02815 | 2.223 | 0.007396 | 0.1178 | fixed |
| birth_order_nonlinear3 | -0.01065 | 0.03274 | -0.3254 | -0.07482 | 0.05352 | fixed |
| birth_order_nonlinear4 | 0.02709 | 0.03839 | 0.7056 | -0.04816 | 0.1023 | fixed |
| birth_order_nonlinear5 | -0.001689 | 0.04332 | -0.039 | -0.08659 | 0.08321 | fixed |
| birth_order_nonlinear5+ | 0.006358 | 0.03898 | 0.1631 | -0.07005 | 0.08277 | fixed |
| sd_(Intercept).mother_pidlink | 0.5461 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7893 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.638 | 0.4657 | -14.25 | -7.55 | -5.725 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7279 | 0.06307 | 11.54 | 0.6043 | 0.8515 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0237 | 0.002791 | -8.491 | -0.02917 | -0.01823 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002319 | 0.00004068 | 5.701 | 0.0001522 | 0.0003116 | fixed |
| male | 0.04812 | 0.01897 | 2.537 | 0.01094 | 0.08529 | fixed |
| count_birth_order2/2 | 0.06072 | 0.05725 | 1.061 | -0.05149 | 0.1729 | fixed |
| count_birth_order1/3 | -0.0343 | 0.05105 | -0.6719 | -0.1344 | 0.06576 | fixed |
| count_birth_order2/3 | 0.07454 | 0.05626 | 1.325 | -0.03572 | 0.1848 | fixed |
| count_birth_order3/3 | -0.05386 | 0.06313 | -0.8531 | -0.1776 | 0.06987 | fixed |
| count_birth_order1/4 | -0.1607 | 0.05803 | -2.769 | -0.2744 | -0.04693 | fixed |
| count_birth_order2/4 | -0.07732 | 0.05939 | -1.302 | -0.1937 | 0.03909 | fixed |
| count_birth_order3/4 | -0.1763 | 0.06208 | -2.84 | -0.298 | -0.05465 | fixed |
| count_birth_order4/4 | 0.01525 | 0.06777 | 0.2251 | -0.1176 | 0.1481 | fixed |
| count_birth_order1/5 | -0.1478 | 0.07044 | -2.098 | -0.2858 | -0.009719 | fixed |
| count_birth_order2/5 | -0.09451 | 0.07441 | -1.27 | -0.2403 | 0.05133 | fixed |
| count_birth_order3/5 | -0.2273 | 0.07096 | -3.204 | -0.3664 | -0.08824 | fixed |
| count_birth_order4/5 | -0.1158 | 0.07449 | -1.554 | -0.2618 | 0.03024 | fixed |
| count_birth_order5/5 | -0.02131 | 0.07249 | -0.294 | -0.1634 | 0.1208 | fixed |
| count_birth_order1/5+ | -0.2317 | 0.06517 | -3.555 | -0.3594 | -0.1039 | fixed |
| count_birth_order2/5+ | -0.271 | 0.06388 | -4.242 | -0.3962 | -0.1458 | fixed |
| count_birth_order3/5+ | -0.2168 | 0.05985 | -3.622 | -0.3341 | -0.09946 | fixed |
| count_birth_order4/5+ | -0.3418 | 0.05625 | -6.076 | -0.452 | -0.2315 | fixed |
| count_birth_order5/5+ | -0.3567 | 0.05421 | -6.58 | -0.4629 | -0.2504 | fixed |
| count_birth_order5+/5+ | -0.3052 | 0.0421 | -7.248 | -0.3877 | -0.2226 | fixed |
| sd_(Intercept).mother_pidlink | 0.5453 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7889 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 24804 | 24882 | -12391 | 24782 | NA | NA | NA |
| 12 | 24806 | 24891 | -12391 | 24782 | 0.03716 | 1 | 0.8471 |
| 16 | 24807 | 24921 | -12387 | 24775 | 7.146 | 4 | 0.1284 |
| 26 | 24803 | 24988 | -12376 | 24751 | 23.59 | 10 | 0.008753 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.861 | 0.9731 | -7.051 | -8.769 | -4.954 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7568 | 0.1455 | 5.202 | 0.4717 | 1.042 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02486 | 0.00708 | -3.511 | -0.03873 | -0.01098 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002526 | 0.0001124 | 2.248 | 0.00003234 | 0.0004728 | fixed |
| male | 0.01685 | 0.0235 | 0.7172 | -0.0292 | 0.0629 | fixed |
| sibling_count3 | -0.01718 | 0.03598 | -0.4774 | -0.0877 | 0.05334 | fixed |
| sibling_count4 | -0.1219 | 0.04074 | -2.991 | -0.2017 | -0.04201 | fixed |
| sibling_count5 | -0.1907 | 0.04921 | -3.875 | -0.2871 | -0.09422 | fixed |
| sibling_count5+ | -0.2719 | 0.04397 | -6.184 | -0.3581 | -0.1857 | fixed |
| sd_(Intercept).mother_pidlink | 0.5182 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7306 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.915 | 0.9742 | -7.098 | -8.824 | -5.005 | fixed |
| birth_order | 0.009749 | 0.009035 | 1.079 | -0.007959 | 0.02746 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7625 | 0.1456 | 5.238 | 0.4772 | 1.048 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02513 | 0.007083 | -3.548 | -0.03901 | -0.01125 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002572 | 0.0001124 | 2.288 | 0.00003685 | 0.0004776 | fixed |
| male | 0.01654 | 0.0235 | 0.7041 | -0.02951 | 0.06259 | fixed |
| sibling_count3 | -0.02201 | 0.03626 | -0.6069 | -0.09308 | 0.04907 | fixed |
| sibling_count4 | -0.1335 | 0.04217 | -3.167 | -0.2162 | -0.0509 | fixed |
| sibling_count5 | -0.2107 | 0.0526 | -4.005 | -0.3138 | -0.1076 | fixed |
| sibling_count5+ | -0.315 | 0.05944 | -5.3 | -0.4315 | -0.1986 | fixed |
| sd_(Intercept).mother_pidlink | 0.5188 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7303 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.964 | 0.9744 | -7.147 | -8.874 | -5.054 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7685 | 0.1456 | 5.279 | 0.4831 | 1.054 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02539 | 0.007084 | -3.584 | -0.03927 | -0.01151 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000261 | 0.0001124 | 2.322 | 0.00004065 | 0.0004813 | fixed |
| male | 0.01645 | 0.0235 | 0.7003 | -0.0296 | 0.0625 | fixed |
| sibling_count3 | -0.02539 | 0.03711 | -0.6843 | -0.09813 | 0.04734 | fixed |
| sibling_count4 | -0.1275 | 0.04426 | -2.88 | -0.2142 | -0.04071 | fixed |
| sibling_count5 | -0.2088 | 0.05603 | -3.726 | -0.3186 | -0.09897 | fixed |
| sibling_count5+ | -0.3376 | 0.06226 | -5.423 | -0.4596 | -0.2156 | fixed |
| birth_order_nonlinear2 | 0.05199 | 0.02881 | 1.805 | -0.004469 | 0.1085 | fixed |
| birth_order_nonlinear3 | 0.03421 | 0.03777 | 0.9058 | -0.03981 | 0.1082 | fixed |
| birth_order_nonlinear4 | 0.001927 | 0.04906 | 0.03928 | -0.09422 | 0.09808 | fixed |
| birth_order_nonlinear5 | 0.07045 | 0.06369 | 1.106 | -0.05438 | 0.1953 | fixed |
| birth_order_nonlinear5+ | 0.1232 | 0.06923 | 1.78 | -0.01244 | 0.2589 | fixed |
| sd_(Intercept).mother_pidlink | 0.5199 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7295 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.96 | 0.9751 | -7.138 | -8.871 | -5.049 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7688 | 0.1457 | 5.276 | 0.4832 | 1.054 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0254 | 0.007091 | -3.582 | -0.0393 | -0.0115 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002612 | 0.0001125 | 2.321 | 0.00004067 | 0.0004818 | fixed |
| male | 0.01598 | 0.02351 | 0.6795 | -0.03011 | 0.06206 | fixed |
| count_birth_order2/2 | 0.02934 | 0.04729 | 0.6205 | -0.06334 | 0.122 | fixed |
| count_birth_order1/3 | -0.05929 | 0.04542 | -1.305 | -0.1483 | 0.02973 | fixed |
| count_birth_order2/3 | 0.04985 | 0.04937 | 1.01 | -0.04693 | 0.1466 | fixed |
| count_birth_order3/3 | 0.01367 | 0.05506 | 0.2483 | -0.09425 | 0.1216 | fixed |
| count_birth_order1/4 | -0.1267 | 0.06105 | -2.076 | -0.2464 | -0.007086 | fixed |
| count_birth_order2/4 | -0.1538 | 0.06097 | -2.523 | -0.2733 | -0.03431 | fixed |
| count_birth_order3/4 | -0.1289 | 0.06357 | -2.028 | -0.2535 | -0.004344 | fixed |
| count_birth_order4/4 | -0.04741 | 0.06315 | -0.7507 | -0.1712 | 0.07637 | fixed |
| count_birth_order1/5 | -0.1687 | 0.09218 | -1.83 | -0.3493 | 0.01201 | fixed |
| count_birth_order2/5 | -0.1148 | 0.09718 | -1.181 | -0.3052 | 0.07568 | fixed |
| count_birth_order3/5 | -0.2755 | 0.08563 | -3.218 | -0.4434 | -0.1077 | fixed |
| count_birth_order4/5 | -0.2379 | 0.08049 | -2.956 | -0.3957 | -0.08014 | fixed |
| count_birth_order5/5 | -0.1169 | 0.07802 | -1.499 | -0.2698 | 0.03599 | fixed |
| count_birth_order1/5+ | -0.2922 | 0.1129 | -2.589 | -0.5134 | -0.07097 | fixed |
| count_birth_order2/5+ | -0.2078 | 0.1108 | -1.876 | -0.4248 | 0.009291 | fixed |
| count_birth_order3/5+ | -0.1477 | 0.09608 | -1.537 | -0.336 | 0.04059 | fixed |
| count_birth_order4/5+ | -0.4902 | 0.08614 | -5.691 | -0.659 | -0.3214 | fixed |
| count_birth_order5/5+ | -0.3071 | 0.07735 | -3.971 | -0.4587 | -0.1555 | fixed |
| count_birth_order5+/5+ | -0.2259 | 0.05481 | -4.121 | -0.3333 | -0.1184 | fixed |
| sd_(Intercept).mother_pidlink | 0.5188 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7294 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 13765 | 13838 | -6872 | 13743 | NA | NA | NA |
| 12 | 13766 | 13845 | -6871 | 13742 | 1.164 | 1 | 0.2806 |
| 16 | 13769 | 13874 | -6868 | 13737 | 5.381 | 4 | 0.2504 |
| 26 | 13771 | 13942 | -6860 | 13719 | 17.62 | 10 | 0.06172 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.83 | 0.9707 | -7.036 | -8.733 | -4.927 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7549 | 0.1451 | 5.203 | 0.4705 | 1.039 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0248 | 0.007062 | -3.511 | -0.03864 | -0.01096 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000252 | 0.0001121 | 2.248 | 0.00003226 | 0.0004717 | fixed |
| male | 0.0151 | 0.0234 | 0.6455 | -0.03075 | 0.06096 | fixed |
| sibling_count3 | -0.03337 | 0.03864 | -0.8637 | -0.1091 | 0.04236 | fixed |
| sibling_count4 | -0.08849 | 0.0421 | -2.102 | -0.171 | -0.00597 | fixed |
| sibling_count5 | -0.1713 | 0.04757 | -3.6 | -0.2645 | -0.07803 | fixed |
| sibling_count5+ | -0.2459 | 0.04111 | -5.981 | -0.3265 | -0.1653 | fixed |
| sd_(Intercept).mother_pidlink | 0.5178 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.73 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.846 | 0.9721 | -7.042 | -8.751 | -4.94 | fixed |
| birth_order | 0.002372 | 0.007711 | 0.3077 | -0.01274 | 0.01749 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7566 | 0.1452 | 5.21 | 0.472 | 1.041 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02488 | 0.007068 | -3.521 | -0.03873 | -0.01103 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002533 | 0.0001122 | 2.258 | 0.00003344 | 0.0004732 | fixed |
| male | 0.015 | 0.0234 | 0.6411 | -0.03086 | 0.06087 | fixed |
| sibling_count3 | -0.03458 | 0.03885 | -0.8902 | -0.1107 | 0.04156 | fixed |
| sibling_count4 | -0.09117 | 0.043 | -2.12 | -0.1755 | -0.006886 | fixed |
| sibling_count5 | -0.1758 | 0.04978 | -3.531 | -0.2733 | -0.0782 | fixed |
| sibling_count5+ | -0.2556 | 0.05184 | -4.931 | -0.3572 | -0.154 | fixed |
| sd_(Intercept).mother_pidlink | 0.518 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7299 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.917 | 0.9721 | -7.115 | -8.822 | -5.011 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.763 | 0.1452 | 5.254 | 0.4784 | 1.048 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02513 | 0.007068 | -3.556 | -0.03898 | -0.01128 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002564 | 0.0001122 | 2.286 | 0.00003657 | 0.0004763 | fixed |
| male | 0.01531 | 0.0234 | 0.6541 | -0.03056 | 0.06117 | fixed |
| sibling_count3 | -0.03284 | 0.03966 | -0.828 | -0.1106 | 0.04489 | fixed |
| sibling_count4 | -0.08939 | 0.04488 | -1.992 | -0.1774 | -0.001434 | fixed |
| sibling_count5 | -0.1838 | 0.0527 | -3.487 | -0.2871 | -0.08049 | fixed |
| sibling_count5+ | -0.2573 | 0.05375 | -4.787 | -0.3626 | -0.1519 | fixed |
| birth_order_nonlinear2 | 0.07217 | 0.02953 | 2.444 | 0.0143 | 0.13 | fixed |
| birth_order_nonlinear3 | -0.005236 | 0.03733 | -0.1403 | -0.07839 | 0.06792 | fixed |
| birth_order_nonlinear4 | 0.02286 | 0.04685 | 0.4879 | -0.06896 | 0.1147 | fixed |
| birth_order_nonlinear5 | 0.07559 | 0.05817 | 1.299 | -0.03842 | 0.1896 | fixed |
| birth_order_nonlinear5+ | 0.033 | 0.05905 | 0.5588 | -0.08273 | 0.1487 | fixed |
| sd_(Intercept).mother_pidlink | 0.5181 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7295 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.899 | 0.9721 | -7.097 | -8.804 | -4.994 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7606 | 0.1453 | 5.236 | 0.4759 | 1.045 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02507 | 0.007069 | -3.546 | -0.03892 | -0.01121 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002566 | 0.0001122 | 2.287 | 0.00003666 | 0.0004765 | fixed |
| male | 0.01386 | 0.02341 | 0.5922 | -0.03201 | 0.05974 | fixed |
| count_birth_order2/2 | 0.08613 | 0.05191 | 1.659 | -0.01561 | 0.1879 | fixed |
| count_birth_order1/3 | -0.06727 | 0.04895 | -1.374 | -0.1632 | 0.02867 | fixed |
| count_birth_order2/3 | 0.05816 | 0.05259 | 1.106 | -0.04492 | 0.1612 | fixed |
| count_birth_order3/3 | 0.02034 | 0.05905 | 0.3444 | -0.0954 | 0.1361 | fixed |
| count_birth_order1/4 | -0.07108 | 0.06131 | -1.159 | -0.1912 | 0.04909 | fixed |
| count_birth_order2/4 | -0.06081 | 0.06189 | -0.9826 | -0.1821 | 0.06049 | fixed |
| count_birth_order3/4 | -0.1245 | 0.06503 | -1.914 | -0.2519 | 0.002971 | fixed |
| count_birth_order4/4 | 0.005626 | 0.06667 | 0.08438 | -0.125 | 0.1363 | fixed |
| count_birth_order1/5 | -0.07135 | 0.08316 | -0.858 | -0.2343 | 0.09164 | fixed |
| count_birth_order2/5 | -0.1042 | 0.0841 | -1.239 | -0.269 | 0.06065 | fixed |
| count_birth_order3/5 | -0.3061 | 0.08024 | -3.815 | -0.4633 | -0.1488 | fixed |
| count_birth_order4/5 | -0.1987 | 0.08071 | -2.461 | -0.3569 | -0.04048 | fixed |
| count_birth_order5/5 | -0.06386 | 0.07738 | -0.8252 | -0.2155 | 0.08781 | fixed |
| count_birth_order1/5+ | -0.2017 | 0.08248 | -2.446 | -0.3634 | -0.04007 | fixed |
| count_birth_order2/5+ | -0.1627 | 0.09223 | -1.764 | -0.3435 | 0.01808 | fixed |
| count_birth_order3/5+ | -0.1926 | 0.08051 | -2.392 | -0.3504 | -0.03479 | fixed |
| count_birth_order4/5+ | -0.2925 | 0.07496 | -3.902 | -0.4394 | -0.1456 | fixed |
| count_birth_order5/5+ | -0.2174 | 0.07194 | -3.022 | -0.3584 | -0.07641 | fixed |
| count_birth_order5+/5+ | -0.2229 | 0.05227 | -4.265 | -0.3254 | -0.1205 | fixed |
| sd_(Intercept).mother_pidlink | 0.5195 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7283 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 13877 | 13950 | -6928 | 13855 | NA | NA | NA |
| 12 | 13879 | 13958 | -6927 | 13855 | 0.09453 | 1 | 0.7585 |
| 16 | 13878 | 13984 | -6923 | 13846 | 8.425 | 4 | 0.07721 |
| 26 | 13884 | 14056 | -6916 | 13832 | 14.31 | 10 | 0.1592 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.615 | 0.9829 | -6.73 | -8.542 | -4.689 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7211 | 0.1469 | 4.91 | 0.4333 | 1.009 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02326 | 0.007145 | -3.256 | -0.03726 | -0.009257 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000229 | 0.0001133 | 2.02 | 0.000006808 | 0.0004511 | fixed |
| male | 0.01755 | 0.02385 | 0.736 | -0.02919 | 0.0643 | fixed |
| sibling_count3 | -0.01117 | 0.03603 | -0.31 | -0.08178 | 0.05944 | fixed |
| sibling_count4 | -0.1152 | 0.04097 | -2.812 | -0.1955 | -0.03491 | fixed |
| sibling_count5 | -0.1965 | 0.05121 | -3.837 | -0.2968 | -0.0961 | fixed |
| sibling_count5+ | -0.2427 | 0.0452 | -5.369 | -0.3313 | -0.1541 | fixed |
| sd_(Intercept).mother_pidlink | 0.5228 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.731 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.68 | 0.9842 | -6.787 | -8.609 | -4.751 | fixed |
| birth_order | 0.01105 | 0.009284 | 1.19 | -0.007151 | 0.02924 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7283 | 0.147 | 4.955 | 0.4402 | 1.016 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02361 | 0.007149 | -3.303 | -0.03762 | -0.009598 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002349 | 0.0001134 | 2.071 | 0.00001261 | 0.0004572 | fixed |
| male | 0.01736 | 0.02385 | 0.7279 | -0.02938 | 0.0641 | fixed |
| sibling_count3 | -0.01649 | 0.03631 | -0.4542 | -0.08766 | 0.05468 | fixed |
| sibling_count4 | -0.1285 | 0.04248 | -3.026 | -0.2118 | -0.04528 | fixed |
| sibling_count5 | -0.2186 | 0.05449 | -4.011 | -0.3254 | -0.1118 | fixed |
| sibling_count5+ | -0.2912 | 0.06091 | -4.781 | -0.4106 | -0.1718 | fixed |
| sd_(Intercept).mother_pidlink | 0.5235 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7306 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.689 | 0.9848 | -6.792 | -8.619 | -4.759 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7288 | 0.147 | 4.956 | 0.4406 | 1.017 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02361 | 0.007152 | -3.302 | -0.03763 | -0.009594 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002347 | 0.0001135 | 2.069 | 0.00001234 | 0.0004571 | fixed |
| male | 0.01744 | 0.02385 | 0.731 | -0.02931 | 0.06419 | fixed |
| sibling_count3 | -0.02629 | 0.03714 | -0.7078 | -0.09908 | 0.04651 | fixed |
| sibling_count4 | -0.1254 | 0.04463 | -2.81 | -0.2129 | -0.03793 | fixed |
| sibling_count5 | -0.2056 | 0.05789 | -3.552 | -0.3191 | -0.09215 | fixed |
| sibling_count5+ | -0.302 | 0.0639 | -4.727 | -0.4273 | -0.1768 | fixed |
| birth_order_nonlinear2 | 0.05142 | 0.02888 | 1.78 | -0.005198 | 0.108 | fixed |
| birth_order_nonlinear3 | 0.06668 | 0.03813 | 1.749 | -0.008058 | 0.1414 | fixed |
| birth_order_nonlinear4 | -0.007045 | 0.05027 | -0.1401 | -0.1056 | 0.09148 | fixed |
| birth_order_nonlinear5 | 0.02412 | 0.06693 | 0.3604 | -0.1071 | 0.1553 | fixed |
| birth_order_nonlinear5+ | 0.1217 | 0.07164 | 1.699 | -0.01869 | 0.2621 | fixed |
| sd_(Intercept).mother_pidlink | 0.5233 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7304 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.726 | 0.9854 | -6.825 | -8.657 | -4.795 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7345 | 0.1472 | 4.991 | 0.4461 | 1.023 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02385 | 0.007159 | -3.332 | -0.03788 | -0.009823 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002381 | 0.0001136 | 2.097 | 0.00001553 | 0.0004607 | fixed |
| male | 0.01742 | 0.02388 | 0.7295 | -0.02938 | 0.06422 | fixed |
| count_birth_order2/2 | 0.02951 | 0.04629 | 0.6375 | -0.06121 | 0.1202 | fixed |
| count_birth_order1/3 | -0.06344 | 0.04539 | -1.398 | -0.1524 | 0.02553 | fixed |
| count_birth_order2/3 | 0.06221 | 0.04994 | 1.246 | -0.03567 | 0.1601 | fixed |
| count_birth_order3/3 | 0.03591 | 0.05522 | 0.6502 | -0.07233 | 0.1441 | fixed |
| count_birth_order1/4 | -0.1158 | 0.062 | -1.867 | -0.2373 | 0.00576 | fixed |
| count_birth_order2/4 | -0.1576 | 0.06146 | -2.564 | -0.278 | -0.03711 | fixed |
| count_birth_order3/4 | -0.1036 | 0.06379 | -1.624 | -0.2286 | 0.02142 | fixed |
| count_birth_order4/4 | -0.05084 | 0.06338 | -0.8021 | -0.1751 | 0.07338 | fixed |
| count_birth_order1/5 | -0.1952 | 0.0937 | -2.083 | -0.3788 | -0.01153 | fixed |
| count_birth_order2/5 | -0.1358 | 0.1035 | -1.312 | -0.3386 | 0.06706 | fixed |
| count_birth_order3/5 | -0.189 | 0.09007 | -2.098 | -0.3656 | -0.01248 | fixed |
| count_birth_order4/5 | -0.2471 | 0.08507 | -2.905 | -0.4139 | -0.08038 | fixed |
| count_birth_order5/5 | -0.1613 | 0.08299 | -1.943 | -0.3239 | 0.001389 | fixed |
| count_birth_order1/5+ | -0.1999 | 0.1156 | -1.729 | -0.4266 | 0.02673 | fixed |
| count_birth_order2/5+ | -0.204 | 0.1144 | -1.783 | -0.4282 | 0.02024 | fixed |
| count_birth_order3/5+ | -0.08644 | 0.09791 | -0.8828 | -0.2783 | 0.1055 | fixed |
| count_birth_order4/5+ | -0.4909 | 0.09081 | -5.405 | -0.6689 | -0.3129 | fixed |
| count_birth_order5/5+ | -0.3151 | 0.08087 | -3.897 | -0.4736 | -0.1566 | fixed |
| count_birth_order5+/5+ | -0.1932 | 0.05652 | -3.418 | -0.304 | -0.08242 | fixed |
| sd_(Intercept).mother_pidlink | 0.5227 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.73 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 13447 | 13519 | -6713 | 13425 | NA | NA | NA |
| 12 | 13448 | 13526 | -6712 | 13424 | 1.415 | 1 | 0.2342 |
| 16 | 13449 | 13554 | -6708 | 13417 | 6.748 | 4 | 0.1498 |
| 26 | 13451 | 13621 | -6699 | 13399 | 18.11 | 10 | 0.05321 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = math_2007_young)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.754 | 0.4653 | -14.52 | -7.666 | -5.842 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7929 | 0.06319 | 12.55 | 0.6691 | 0.9168 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02804 | 0.002801 | -10.01 | -0.03352 | -0.02255 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003055 | 0.00004089 | 7.472 | 0.0002254 | 0.0003856 | fixed |
| male | -0.1437 | 0.01893 | -7.589 | -0.1808 | -0.1066 | fixed |
| sibling_count3 | 0.0287 | 0.04191 | 0.6847 | -0.05345 | 0.1108 | fixed |
| sibling_count4 | -0.1166 | 0.04282 | -2.724 | -0.2006 | -0.03272 | fixed |
| sibling_count5 | -0.0236 | 0.04622 | -0.5106 | -0.1142 | 0.06699 | fixed |
| sibling_count5+ | -0.2097 | 0.037 | -5.668 | -0.2822 | -0.1372 | fixed |
| sd_(Intercept).mother_pidlink | 0.5785 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7773 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.752 | 0.4653 | -14.51 | -7.664 | -5.84 | fixed |
| birth_order | 0.001749 | 0.004367 | 0.4004 | -0.00681 | 0.01031 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7921 | 0.06322 | 12.53 | 0.6682 | 0.916 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.028 | 0.002802 | -9.99 | -0.03349 | -0.0225 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000305 | 0.0000409 | 7.457 | 0.0002249 | 0.0003852 | fixed |
| male | -0.1438 | 0.01893 | -7.595 | -0.1809 | -0.1067 | fixed |
| sibling_count3 | 0.02781 | 0.04197 | 0.6625 | -0.05446 | 0.1101 | fixed |
| sibling_count4 | -0.1186 | 0.04311 | -2.752 | -0.2031 | -0.03414 | fixed |
| sibling_count5 | -0.02692 | 0.04696 | -0.5733 | -0.119 | 0.06512 | fixed |
| sibling_count5+ | -0.2191 | 0.04378 | -5.005 | -0.3049 | -0.1333 | fixed |
| sd_(Intercept).mother_pidlink | 0.5787 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7773 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.789 | 0.4661 | -14.57 | -7.702 | -5.875 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7953 | 0.06325 | 12.57 | 0.6713 | 0.9193 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02812 | 0.002803 | -10.03 | -0.03362 | -0.02263 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003066 | 0.00004091 | 7.494 | 0.0002264 | 0.0003868 | fixed |
| male | -0.1439 | 0.01893 | -7.602 | -0.181 | -0.1068 | fixed |
| sibling_count3 | 0.02289 | 0.04252 | 0.5382 | -0.06046 | 0.1062 | fixed |
| sibling_count4 | -0.1276 | 0.04453 | -2.865 | -0.2149 | -0.04033 | fixed |
| sibling_count5 | -0.02192 | 0.04929 | -0.4446 | -0.1185 | 0.0747 | fixed |
| sibling_count5+ | -0.218 | 0.04654 | -4.684 | -0.3092 | -0.1268 | fixed |
| birth_order_nonlinear2 | 0.04666 | 0.02802 | 1.665 | -0.008259 | 0.1016 | fixed |
| birth_order_nonlinear3 | 0.02498 | 0.0326 | 0.7662 | -0.03892 | 0.08888 | fixed |
| birth_order_nonlinear4 | 0.0334 | 0.03827 | 0.8727 | -0.0416 | 0.1084 | fixed |
| birth_order_nonlinear5 | -0.03609 | 0.0432 | -0.8353 | -0.1208 | 0.04859 | fixed |
| birth_order_nonlinear5+ | 0.031 | 0.03917 | 0.7913 | -0.04577 | 0.1078 | fixed |
| sd_(Intercept).mother_pidlink | 0.5785 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7773 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.828 | 0.4667 | -14.63 | -7.743 | -5.913 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7989 | 0.06328 | 12.62 | 0.6749 | 0.9229 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02826 | 0.002804 | -10.08 | -0.03376 | -0.02277 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003083 | 0.00004092 | 7.535 | 0.0002281 | 0.0003886 | fixed |
| male | -0.144 | 0.01894 | -7.6 | -0.1811 | -0.1068 | fixed |
| count_birth_order2/2 | 0.08251 | 0.0571 | 1.445 | -0.0294 | 0.1944 | fixed |
| count_birth_order1/3 | 0.04288 | 0.05146 | 0.8333 | -0.05798 | 0.1437 | fixed |
| count_birth_order2/3 | 0.08563 | 0.05661 | 1.513 | -0.02533 | 0.1966 | fixed |
| count_birth_order3/3 | 0.03055 | 0.06347 | 0.4813 | -0.09384 | 0.1549 | fixed |
| count_birth_order1/4 | -0.1306 | 0.05842 | -2.235 | -0.2451 | -0.01608 | fixed |
| count_birth_order2/4 | -0.08114 | 0.05974 | -1.358 | -0.1982 | 0.03595 | fixed |
| count_birth_order3/4 | -0.1099 | 0.06239 | -1.761 | -0.2322 | 0.01243 | fixed |
| count_birth_order4/4 | -0.02188 | 0.06808 | -0.3214 | -0.1553 | 0.1116 | fixed |
| count_birth_order1/5 | -0.062 | 0.0708 | -0.8757 | -0.2008 | 0.07676 | fixed |
| count_birth_order2/5 | -0.01654 | 0.07469 | -0.2215 | -0.1629 | 0.1299 | fixed |
| count_birth_order3/5 | 0.07044 | 0.07124 | 0.9888 | -0.06918 | 0.2101 | fixed |
| count_birth_order4/5 | 0.06037 | 0.07477 | 0.8075 | -0.08617 | 0.2069 | fixed |
| count_birth_order5/5 | -0.03592 | 0.07285 | -0.4931 | -0.1787 | 0.1069 | fixed |
| count_birth_order1/5+ | -0.1415 | 0.06539 | -2.164 | -0.2697 | -0.01333 | fixed |
| count_birth_order2/5+ | -0.1494 | 0.06406 | -2.332 | -0.2749 | -0.02384 | fixed |
| count_birth_order3/5+ | -0.1759 | 0.06005 | -2.929 | -0.2936 | -0.05817 | fixed |
| count_birth_order4/5+ | -0.2217 | 0.05646 | -3.927 | -0.3324 | -0.1111 | fixed |
| count_birth_order5/5+ | -0.2462 | 0.05442 | -4.524 | -0.3529 | -0.1396 | fixed |
| count_birth_order5+/5+ | -0.1776 | 0.04252 | -4.176 | -0.2609 | -0.09422 | fixed |
| sd_(Intercept).mother_pidlink | 0.5778 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7777 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 24867 | 24945 | -12423 | 24845 | NA | NA | NA |
| 12 | 24869 | 24954 | -12422 | 24845 | 0.1601 | 1 | 0.6891 |
| 16 | 24871 | 24985 | -12419 | 24839 | 6.098 | 4 | 0.1919 |
| 26 | 24882 | 25068 | -12415 | 24830 | 8.388 | 10 | 0.591 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.329 | 1.011 | -7.253 | -9.31 | -5.349 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.862 | 0.1511 | 5.705 | 0.5659 | 1.158 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03069 | 0.007352 | -4.174 | -0.0451 | -0.01628 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003444 | 0.0001167 | 2.952 | 0.0001157 | 0.0005731 | fixed |
| male | -0.1627 | 0.02442 | -6.663 | -0.2106 | -0.1148 | fixed |
| sibling_count3 | 0.03514 | 0.03749 | 0.9373 | -0.03834 | 0.1086 | fixed |
| sibling_count4 | -0.03986 | 0.04246 | -0.9387 | -0.1231 | 0.04336 | fixed |
| sibling_count5 | -0.09433 | 0.05129 | -1.839 | -0.1949 | 0.006192 | fixed |
| sibling_count5+ | -0.1596 | 0.04583 | -3.483 | -0.2494 | -0.0698 | fixed |
| sd_(Intercept).mother_pidlink | 0.5442 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7571 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.448 | 1.011 | -7.364 | -9.431 | -5.466 | fixed |
| birth_order | 0.02171 | 0.009399 | 2.31 | 0.003291 | 0.04013 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8745 | 0.1511 | 5.787 | 0.5783 | 1.171 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03129 | 0.007353 | -4.255 | -0.0457 | -0.01687 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003545 | 0.0001167 | 3.038 | 0.0001258 | 0.0005833 | fixed |
| male | -0.1634 | 0.02441 | -6.693 | -0.2112 | -0.1155 | fixed |
| sibling_count3 | 0.02437 | 0.03776 | 0.6453 | -0.04965 | 0.09839 | fixed |
| sibling_count4 | -0.06593 | 0.04392 | -1.501 | -0.152 | 0.02015 | fixed |
| sibling_count5 | -0.139 | 0.0548 | -2.537 | -0.2464 | -0.0316 | fixed |
| sibling_count5+ | -0.2558 | 0.06191 | -4.132 | -0.3771 | -0.1345 | fixed |
| sd_(Intercept).mother_pidlink | 0.5443 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7566 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.45 | 1.013 | -7.356 | -9.435 | -5.465 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8771 | 0.1513 | 5.797 | 0.5806 | 1.174 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03139 | 0.007362 | -4.264 | -0.04582 | -0.01696 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003557 | 0.0001168 | 3.044 | 0.0001267 | 0.0005847 | fixed |
| male | -0.1636 | 0.02443 | -6.696 | -0.2115 | -0.1157 | fixed |
| sibling_count3 | 0.02301 | 0.03864 | 0.5955 | -0.05272 | 0.09875 | fixed |
| sibling_count4 | -0.07166 | 0.04609 | -1.555 | -0.162 | 0.01868 | fixed |
| sibling_count5 | -0.1373 | 0.05835 | -2.353 | -0.2516 | -0.02293 | fixed |
| sibling_count5+ | -0.2439 | 0.06483 | -3.762 | -0.371 | -0.1168 | fixed |
| birth_order_nonlinear2 | 0.03194 | 0.02994 | 1.067 | -0.02674 | 0.09062 | fixed |
| birth_order_nonlinear3 | 0.0497 | 0.03926 | 1.266 | -0.02725 | 0.1266 | fixed |
| birth_order_nonlinear4 | 0.08489 | 0.05101 | 1.664 | -0.01509 | 0.1849 | fixed |
| birth_order_nonlinear5 | 0.06655 | 0.06622 | 1.005 | -0.06324 | 0.1963 | fixed |
| birth_order_nonlinear5+ | 0.1277 | 0.07203 | 1.774 | -0.01342 | 0.2689 | fixed |
| sd_(Intercept).mother_pidlink | 0.5439 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7573 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.405 | 1.014 | -7.305 | -9.392 | -5.419 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8706 | 0.1515 | 5.747 | 0.5737 | 1.168 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03108 | 0.007371 | -4.216 | -0.04553 | -0.01663 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003509 | 0.000117 | 3 | 0.0001216 | 0.0005802 | fixed |
| male | -0.1619 | 0.02446 | -6.622 | -0.2099 | -0.114 | fixed |
| count_birth_order2/2 | 0.0297 | 0.04917 | 0.6042 | -0.06666 | 0.1261 | fixed |
| count_birth_order1/3 | 0.03687 | 0.04727 | 0.7801 | -0.05577 | 0.1295 | fixed |
| count_birth_order2/3 | 0.05894 | 0.05138 | 1.147 | -0.04177 | 0.1596 | fixed |
| count_birth_order3/3 | 0.03767 | 0.0573 | 0.6574 | -0.07463 | 0.15 | fixed |
| count_birth_order1/4 | -0.07716 | 0.06353 | -1.215 | -0.2017 | 0.04735 | fixed |
| count_birth_order2/4 | -0.05468 | 0.06344 | -0.862 | -0.179 | 0.06965 | fixed |
| count_birth_order3/4 | -0.02054 | 0.06614 | -0.3106 | -0.1502 | 0.1091 | fixed |
| count_birth_order4/4 | 0.02997 | 0.06571 | 0.456 | -0.09883 | 0.1588 | fixed |
| count_birth_order1/5 | -0.09647 | 0.09591 | -1.006 | -0.2844 | 0.09151 | fixed |
| count_birth_order2/5 | -0.2193 | 0.1011 | -2.17 | -0.4174 | -0.02121 | fixed |
| count_birth_order3/5 | -0.1128 | 0.08908 | -1.266 | -0.2874 | 0.06179 | fixed |
| count_birth_order4/5 | -0.09586 | 0.08374 | -1.145 | -0.26 | 0.06827 | fixed |
| count_birth_order5/5 | 0.01419 | 0.08118 | 0.1748 | -0.1449 | 0.1733 | fixed |
| count_birth_order1/5+ | -0.4417 | 0.1174 | -3.762 | -0.6718 | -0.2116 | fixed |
| count_birth_order2/5+ | -0.04547 | 0.1152 | -0.3947 | -0.2712 | 0.1803 | fixed |
| count_birth_order3/5+ | -0.05332 | 0.09993 | -0.5336 | -0.2492 | 0.1425 | fixed |
| count_birth_order4/5+ | -0.1371 | 0.08959 | -1.531 | -0.3127 | 0.03845 | fixed |
| count_birth_order5/5+ | -0.2583 | 0.08046 | -3.21 | -0.416 | -0.1006 | fixed |
| count_birth_order5+/5+ | -0.1188 | 0.05706 | -2.082 | -0.2306 | -0.006936 | fixed |
| sd_(Intercept).mother_pidlink | 0.543 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7573 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 14186 | 14258 | -7082 | 14164 | NA | NA | NA |
| 12 | 14183 | 14262 | -7079 | 14159 | 5.343 | 1 | 0.0208 |
| 16 | 14191 | 14297 | -7080 | 14159 | 0 | 4 | 1 |
| 26 | 14196 | 14368 | -7072 | 14144 | 14.79 | 10 | 0.1397 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.308 | 1.01 | -7.239 | -9.287 | -5.329 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8603 | 0.1509 | 5.701 | 0.5645 | 1.156 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03059 | 0.007344 | -4.166 | -0.04499 | -0.0162 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003423 | 0.0001166 | 2.937 | 0.0001138 | 0.0005708 | fixed |
| male | -0.1626 | 0.02436 | -6.674 | -0.2103 | -0.1148 | fixed |
| sibling_count3 | 0.01646 | 0.04035 | 0.4081 | -0.06262 | 0.09554 | fixed |
| sibling_count4 | -0.04713 | 0.04397 | -1.072 | -0.1333 | 0.03906 | fixed |
| sibling_count5 | -0.06369 | 0.04968 | -1.282 | -0.1611 | 0.03369 | fixed |
| sibling_count5+ | -0.1238 | 0.04294 | -2.883 | -0.2079 | -0.03963 | fixed |
| sd_(Intercept).mother_pidlink | 0.5459 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7572 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.388 | 1.011 | -7.309 | -9.369 | -5.407 | fixed |
| birth_order | 0.01223 | 0.00804 | 1.521 | -0.00353 | 0.02799 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8691 | 0.151 | 5.757 | 0.5732 | 1.165 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03101 | 0.007348 | -4.22 | -0.04541 | -0.01661 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003492 | 0.0001166 | 2.994 | 0.0001206 | 0.0005778 | fixed |
| male | -0.1631 | 0.02436 | -6.695 | -0.2108 | -0.1153 | fixed |
| sibling_count3 | 0.01024 | 0.04055 | 0.2526 | -0.06924 | 0.08973 | fixed |
| sibling_count4 | -0.06099 | 0.04491 | -1.358 | -0.149 | 0.02702 | fixed |
| sibling_count5 | -0.08694 | 0.05198 | -1.673 | -0.1888 | 0.01494 | fixed |
| sibling_count5+ | -0.1739 | 0.05412 | -3.213 | -0.28 | -0.06782 | fixed |
| sd_(Intercept).mother_pidlink | 0.5461 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.757 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.397 | 1.012 | -7.31 | -9.38 | -5.414 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8706 | 0.1512 | 5.76 | 0.5744 | 1.167 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03105 | 0.007356 | -4.221 | -0.04547 | -0.01663 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003493 | 0.0001168 | 2.992 | 0.0001205 | 0.0005781 | fixed |
| male | -0.1633 | 0.02438 | -6.697 | -0.211 | -0.1155 | fixed |
| sibling_count3 | 0.00672 | 0.04141 | 0.1623 | -0.07445 | 0.08789 | fixed |
| sibling_count4 | -0.06608 | 0.04687 | -1.41 | -0.1579 | 0.02578 | fixed |
| sibling_count5 | -0.08536 | 0.05504 | -1.551 | -0.1932 | 0.02252 | fixed |
| sibling_count5+ | -0.1641 | 0.05613 | -2.924 | -0.2741 | -0.05413 | fixed |
| birth_order_nonlinear2 | 0.03599 | 0.03073 | 1.171 | -0.02424 | 0.09623 | fixed |
| birth_order_nonlinear3 | 0.03925 | 0.03887 | 1.01 | -0.03693 | 0.1154 | fixed |
| birth_order_nonlinear4 | 0.05036 | 0.0488 | 1.032 | -0.04528 | 0.146 | fixed |
| birth_order_nonlinear5 | 0.03331 | 0.06059 | 0.5497 | -0.08546 | 0.1521 | fixed |
| birth_order_nonlinear5+ | 0.07217 | 0.06157 | 1.172 | -0.04851 | 0.1928 | fixed |
| sd_(Intercept).mother_pidlink | 0.5455 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7577 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.423 | 1.013 | -7.324 | -9.409 | -5.436 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8736 | 0.1514 | 5.77 | 0.5768 | 1.17 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0312 | 0.007368 | -4.235 | -0.04565 | -0.01676 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003521 | 0.000117 | 3.01 | 0.0001228 | 0.0005813 | fixed |
| male | -0.1627 | 0.02441 | -6.664 | -0.2105 | -0.1148 | fixed |
| count_birth_order2/2 | 0.05236 | 0.05412 | 0.9676 | -0.0537 | 0.1584 | fixed |
| count_birth_order1/3 | 0.01647 | 0.05107 | 0.3225 | -0.08363 | 0.1166 | fixed |
| count_birth_order2/3 | 0.05293 | 0.05487 | 0.9647 | -0.05461 | 0.1605 | fixed |
| count_birth_order3/3 | 0.03427 | 0.0616 | 0.5564 | -0.08646 | 0.155 | fixed |
| count_birth_order1/4 | -0.1059 | 0.06396 | -1.656 | -0.2312 | 0.01946 | fixed |
| count_birth_order2/4 | -0.04341 | 0.06455 | -0.6724 | -0.1699 | 0.08311 | fixed |
| count_birth_order3/4 | -0.03786 | 0.06782 | -0.5582 | -0.1708 | 0.09507 | fixed |
| count_birth_order4/4 | 0.0801 | 0.06955 | 1.152 | -0.05621 | 0.2164 | fixed |
| count_birth_order1/5 | -0.04695 | 0.08674 | -0.5413 | -0.217 | 0.1231 | fixed |
| count_birth_order2/5 | -0.05659 | 0.08771 | -0.6452 | -0.2285 | 0.1153 | fixed |
| count_birth_order3/5 | 0.01862 | 0.08368 | 0.2225 | -0.1454 | 0.1826 | fixed |
| count_birth_order4/5 | -0.1552 | 0.08418 | -1.844 | -0.3202 | 0.009763 | fixed |
| count_birth_order5/5 | -0.0149 | 0.08072 | -0.1846 | -0.1731 | 0.1433 | fixed |
| count_birth_order1/5+ | -0.09441 | 0.08602 | -1.097 | -0.263 | 0.07419 | fixed |
| count_birth_order2/5+ | -0.1298 | 0.09618 | -1.35 | -0.3183 | 0.05868 | fixed |
| count_birth_order3/5+ | -0.1148 | 0.08396 | -1.367 | -0.2794 | 0.04975 | fixed |
| count_birth_order4/5+ | -0.1252 | 0.07818 | -1.602 | -0.2784 | 0.02802 | fixed |
| count_birth_order5/5+ | -0.1599 | 0.07502 | -2.131 | -0.3069 | -0.01284 | fixed |
| count_birth_order5+/5+ | -0.0894 | 0.05454 | -1.639 | -0.1963 | 0.01751 | fixed |
| sd_(Intercept).mother_pidlink | 0.5441 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7586 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 14321 | 14393 | -7149 | 14299 | NA | NA | NA |
| 12 | 14320 | 14399 | -7148 | 14296 | 2.316 | 1 | 0.128 |
| 16 | 14328 | 14434 | -7148 | 14296 | 0.2387 | 4 | 0.9934 |
| 26 | 14339 | 14511 | -7144 | 14287 | 8.723 | 10 | 0.5586 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.342 | 1.021 | -7.189 | -9.344 | -5.341 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8591 | 0.1526 | 5.63 | 0.56 | 1.158 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03046 | 0.007422 | -4.103 | -0.045 | -0.01591 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003395 | 0.0001178 | 2.883 | 0.0001087 | 0.0005703 | fixed |
| male | -0.1635 | 0.02479 | -6.595 | -0.2121 | -0.1149 | fixed |
| sibling_count3 | 0.06614 | 0.03751 | 1.763 | -0.007369 | 0.1397 | fixed |
| sibling_count4 | -0.01357 | 0.04265 | -0.3182 | -0.09718 | 0.07003 | fixed |
| sibling_count5 | -0.1193 | 0.05332 | -2.238 | -0.2238 | -0.0148 | fixed |
| sibling_count5+ | -0.1277 | 0.04707 | -2.714 | -0.22 | -0.03547 | fixed |
| sd_(Intercept).mother_pidlink | 0.5469 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7586 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.466 | 1.022 | -7.304 | -9.47 | -5.463 | fixed |
| birth_order | 0.02146 | 0.009655 | 2.223 | 0.002538 | 0.04038 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8728 | 0.1526 | 5.718 | 0.5736 | 1.172 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03112 | 0.007425 | -4.192 | -0.04568 | -0.01657 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003509 | 0.0001178 | 2.979 | 0.00012 | 0.0005818 | fixed |
| male | -0.1639 | 0.02478 | -6.612 | -0.2124 | -0.1153 | fixed |
| sibling_count3 | 0.0558 | 0.03778 | 1.477 | -0.01826 | 0.1299 | fixed |
| sibling_count4 | -0.03953 | 0.04421 | -0.8941 | -0.1262 | 0.04712 | fixed |
| sibling_count5 | -0.1623 | 0.05671 | -2.863 | -0.2735 | -0.05119 | fixed |
| sibling_count5+ | -0.2221 | 0.06338 | -3.504 | -0.3463 | -0.09788 | fixed |
| sd_(Intercept).mother_pidlink | 0.547 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7581 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.462 | 1.024 | -7.289 | -9.469 | -5.456 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8742 | 0.1529 | 5.719 | 0.5746 | 1.174 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03116 | 0.007435 | -4.191 | -0.04573 | -0.01659 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003508 | 0.000118 | 2.974 | 0.0001196 | 0.000582 | fixed |
| male | -0.1639 | 0.02481 | -6.606 | -0.2125 | -0.1152 | fixed |
| sibling_count3 | 0.05035 | 0.03866 | 1.302 | -0.02543 | 0.1261 | fixed |
| sibling_count4 | -0.04989 | 0.04646 | -1.074 | -0.141 | 0.04117 | fixed |
| sibling_count5 | -0.1631 | 0.06026 | -2.707 | -0.2812 | -0.04499 | fixed |
| sibling_count5+ | -0.2083 | 0.06652 | -3.131 | -0.3386 | -0.07789 | fixed |
| birth_order_nonlinear2 | 0.03225 | 0.03003 | 1.074 | -0.0266 | 0.09111 | fixed |
| birth_order_nonlinear3 | 0.06694 | 0.03965 | 1.688 | -0.01077 | 0.1446 | fixed |
| birth_order_nonlinear4 | 0.08688 | 0.05228 | 1.662 | -0.01558 | 0.1893 | fixed |
| birth_order_nonlinear5 | 0.0601 | 0.0696 | 0.8634 | -0.07632 | 0.1965 | fixed |
| birth_order_nonlinear5+ | 0.1203 | 0.07453 | 1.614 | -0.02578 | 0.2664 | fixed |
| sd_(Intercept).mother_pidlink | 0.5465 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7587 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -7.458 | 1.025 | -7.275 | -9.467 | -5.449 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.8732 | 0.1531 | 5.703 | 0.5731 | 1.173 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.03111 | 0.007447 | -4.178 | -0.04571 | -0.01652 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0003503 | 0.0001181 | 2.965 | 0.0001187 | 0.0005818 | fixed |
| male | -0.1617 | 0.02485 | -6.51 | -0.2104 | -0.113 | fixed |
| count_birth_order2/2 | 0.04034 | 0.04816 | 0.8377 | -0.05404 | 0.1347 | fixed |
| count_birth_order1/3 | 0.06742 | 0.04725 | 1.427 | -0.02518 | 0.16 | fixed |
| count_birth_order2/3 | 0.09286 | 0.05198 | 1.787 | -0.009014 | 0.1947 | fixed |
| count_birth_order3/3 | 0.08153 | 0.05748 | 1.418 | -0.03112 | 0.1942 | fixed |
| count_birth_order1/4 | -0.07282 | 0.06453 | -1.128 | -0.1993 | 0.05366 | fixed |
| count_birth_order2/4 | -0.02447 | 0.06396 | -0.3826 | -0.1498 | 0.1009 | fixed |
| count_birth_order3/4 | 0.03036 | 0.06638 | 0.4573 | -0.09975 | 0.1605 | fixed |
| count_birth_order4/4 | 0.0658 | 0.06596 | 0.9975 | -0.06348 | 0.1951 | fixed |
| count_birth_order1/5 | -0.05713 | 0.09751 | -0.5859 | -0.2483 | 0.134 | fixed |
| count_birth_order2/5 | -0.2773 | 0.1077 | -2.576 | -0.4884 | -0.06629 | fixed |
| count_birth_order3/5 | -0.109 | 0.09373 | -1.163 | -0.2928 | 0.07467 | fixed |
| count_birth_order4/5 | -0.1463 | 0.08853 | -1.652 | -0.3198 | 0.02724 | fixed |
| count_birth_order5/5 | -0.02612 | 0.08637 | -0.3025 | -0.1954 | 0.1432 | fixed |
| count_birth_order1/5+ | -0.3727 | 0.1203 | -3.097 | -0.6086 | -0.1369 | fixed |
| count_birth_order2/5+ | -0.0671 | 0.119 | -0.5637 | -0.3004 | 0.1662 | fixed |
| count_birth_order3/5+ | -0.01418 | 0.1019 | -0.1391 | -0.2139 | 0.1855 | fixed |
| count_birth_order4/5+ | -0.08858 | 0.09449 | -0.9374 | -0.2738 | 0.09663 | fixed |
| count_birth_order5/5+ | -0.2156 | 0.08415 | -2.562 | -0.3805 | -0.05066 | fixed |
| count_birth_order5+/5+ | -0.08683 | 0.05884 | -1.476 | -0.2022 | 0.02849 | fixed |
| sd_(Intercept).mother_pidlink | 0.5454 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.759 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 13855 | 13928 | -6917 | 13833 | NA | NA | NA |
| 12 | 13852 | 13931 | -6914 | 13828 | 4.947 | 1 | 0.02613 |
| 16 | 13860 | 13965 | -6914 | 13828 | 0.1435 | 4 | 0.9975 |
| 26 | 13867 | 14037 | -6907 | 13815 | 13.41 | 10 | 0.2014 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = count_backwards)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5158 | 0.1653 | -3.12 | -0.8398 | -0.1918 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.06972 | 0.01599 | 4.359 | 0.03837 | 0.1011 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002356 | 0.0004765 | -4.944 | -0.00329 | -0.001422 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002179 | 0.000004446 | 4.9 | 0.00001307 | 0.0000305 | fixed |
| male | 0.04321 | 0.01663 | 2.599 | 0.01062 | 0.0758 | fixed |
| sibling_count3 | 0.002307 | 0.03444 | 0.06697 | -0.0652 | 0.06981 | fixed |
| sibling_count4 | 0.03135 | 0.03566 | 0.8792 | -0.03854 | 0.1012 | fixed |
| sibling_count5 | 0.0143 | 0.03708 | 0.3855 | -0.05838 | 0.08698 | fixed |
| sibling_count5+ | -0.1004 | 0.0291 | -3.449 | -0.1574 | -0.04334 | fixed |
| sd_(Intercept).mother_pidlink | 0.4186 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8969 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.521 | 0.1653 | -3.152 | -0.845 | -0.1971 | fixed |
| birth_order | -0.007541 | 0.003559 | -2.119 | -0.01452 | -0.0005663 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.07236 | 0.01604 | 4.511 | 0.04092 | 0.1038 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002453 | 0.0004786 | -5.125 | -0.003391 | -0.001515 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000227 | 0.000004466 | 5.083 | 0.00001395 | 0.00003145 | fixed |
| male | 0.04349 | 0.01663 | 2.615 | 0.01089 | 0.07608 | fixed |
| sibling_count3 | 0.00394 | 0.03443 | 0.1144 | -0.06355 | 0.07143 | fixed |
| sibling_count4 | 0.03655 | 0.03572 | 1.023 | -0.03346 | 0.1066 | fixed |
| sibling_count5 | 0.0234 | 0.03731 | 0.6272 | -0.04972 | 0.09652 | fixed |
| sibling_count5+ | -0.07194 | 0.03204 | -2.246 | -0.1347 | -0.009149 | fixed |
| sd_(Intercept).mother_pidlink | 0.4172 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8973 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5287 | 0.1657 | -3.19 | -0.8536 | -0.2039 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.07327 | 0.01604 | 4.567 | 0.04183 | 0.1047 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002467 | 0.0004786 | -5.154 | -0.003405 | -0.001529 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002265 | 0.000004468 | 5.069 | 0.00001389 | 0.0000314 | fixed |
| male | 0.04386 | 0.01662 | 2.638 | 0.01128 | 0.07644 | fixed |
| sibling_count3 | 0.0181 | 0.03489 | 0.5187 | -0.05029 | 0.08648 | fixed |
| sibling_count4 | 0.05936 | 0.03668 | 1.618 | -0.01253 | 0.1313 | fixed |
| sibling_count5 | 0.05141 | 0.03865 | 1.33 | -0.02434 | 0.1272 | fixed |
| sibling_count5+ | -0.04218 | 0.03354 | -1.258 | -0.1079 | 0.02356 | fixed |
| birth_order_nonlinear2 | -0.03426 | 0.02401 | -1.427 | -0.08133 | 0.0128 | fixed |
| birth_order_nonlinear3 | -0.08943 | 0.02829 | -3.162 | -0.1449 | -0.03399 | fixed |
| birth_order_nonlinear4 | -0.08064 | 0.03218 | -2.506 | -0.1437 | -0.01756 | fixed |
| birth_order_nonlinear5 | -0.08633 | 0.03661 | -2.358 | -0.1581 | -0.01458 | fixed |
| birth_order_nonlinear5+ | -0.09508 | 0.03072 | -3.095 | -0.1553 | -0.03486 | fixed |
| sd_(Intercept).mother_pidlink | 0.4188 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8965 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5266 | 0.1665 | -3.163 | -0.8529 | -0.2003 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.07317 | 0.01605 | 4.56 | 0.04172 | 0.1046 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002458 | 0.0004789 | -5.132 | -0.003396 | -0.001519 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002251 | 0.000004471 | 5.034 | 0.00001374 | 0.00003127 | fixed |
| male | 0.04425 | 0.01663 | 2.661 | 0.01166 | 0.07683 | fixed |
| count_birth_order2/2 | -0.04338 | 0.04687 | -0.9254 | -0.1352 | 0.04849 | fixed |
| count_birth_order1/3 | 0.03772 | 0.04498 | 0.8386 | -0.05044 | 0.1259 | fixed |
| count_birth_order2/3 | -0.0197 | 0.05012 | -0.393 | -0.1179 | 0.07853 | fixed |
| count_birth_order3/3 | -0.1232 | 0.05612 | -2.195 | -0.2332 | -0.01317 | fixed |
| count_birth_order1/4 | 0.0815 | 0.05147 | 1.583 | -0.01938 | 0.1824 | fixed |
| count_birth_order2/4 | 0.005026 | 0.05402 | 0.09305 | -0.1009 | 0.1109 | fixed |
| count_birth_order3/4 | -0.06449 | 0.05836 | -1.105 | -0.1789 | 0.0499 | fixed |
| count_birth_order4/4 | -0.009001 | 0.06157 | -0.1462 | -0.1297 | 0.1117 | fixed |
| count_birth_order1/5 | -0.0384 | 0.05782 | -0.6642 | -0.1517 | 0.07492 | fixed |
| count_birth_order2/5 | 0.06285 | 0.06083 | 1.033 | -0.05637 | 0.1821 | fixed |
| count_birth_order3/5 | 0.03161 | 0.06263 | 0.5048 | -0.09113 | 0.1544 | fixed |
| count_birth_order4/5 | -0.05632 | 0.06619 | -0.851 | -0.186 | 0.0734 | fixed |
| count_birth_order5/5 | -0.03531 | 0.06734 | -0.5243 | -0.1673 | 0.09668 | fixed |
| count_birth_order1/5+ | -0.05063 | 0.04693 | -1.079 | -0.1426 | 0.04136 | fixed |
| count_birth_order2/5+ | -0.08895 | 0.04831 | -1.841 | -0.1836 | 0.005739 | fixed |
| count_birth_order3/5+ | -0.1235 | 0.04744 | -2.604 | -0.2165 | -0.03054 | fixed |
| count_birth_order4/5+ | -0.1254 | 0.04636 | -2.705 | -0.2163 | -0.03454 | fixed |
| count_birth_order5/5+ | -0.1327 | 0.0467 | -2.842 | -0.2243 | -0.04119 | fixed |
| count_birth_order5+/5+ | -0.1408 | 0.03701 | -3.804 | -0.2133 | -0.06823 | fixed |
| sd_(Intercept).mother_pidlink | 0.4189 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8965 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 38110 | 38193 | -19044 | 38088 | NA | NA | NA |
| 12 | 38108 | 38198 | -19042 | 38084 | 4.489 | 1 | 0.03411 |
| 16 | 38105 | 38225 | -19037 | 38073 | 10.57 | 4 | 0.03183 |
| 26 | 38116 | 38311 | -19032 | 38064 | 9.266 | 10 | 0.507 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.742 | 0.4065 | -4.284 | -2.538 | -0.9448 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2094 | 0.04611 | 4.543 | 0.1191 | 0.2998 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006882 | 0.001645 | -4.185 | -0.01011 | -0.003659 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00007036 | 0.00001862 | 3.779 | 0.00003387 | 0.0001069 | fixed |
| male | -0.002035 | 0.02375 | -0.08571 | -0.04858 | 0.04451 | fixed |
| sibling_count3 | -0.00724 | 0.0379 | -0.191 | -0.08152 | 0.06704 | fixed |
| sibling_count4 | -0.0264 | 0.04103 | -0.6435 | -0.1068 | 0.05401 | fixed |
| sibling_count5 | -0.07347 | 0.04681 | -1.569 | -0.1652 | 0.01828 | fixed |
| sibling_count5+ | -0.1963 | 0.04127 | -4.756 | -0.2772 | -0.1154 | fixed |
| sd_(Intercept).mother_pidlink | 0.3845 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8347 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.734 | 0.4066 | -4.266 | -2.531 | -0.9374 | fixed |
| birth_order | -0.008164 | 0.00792 | -1.031 | -0.02369 | 0.00736 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2098 | 0.04611 | 4.55 | 0.1194 | 0.3002 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006883 | 0.001645 | -4.185 | -0.01011 | -0.003659 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00007005 | 0.00001862 | 3.762 | 0.00003355 | 0.0001065 | fixed |
| male | -0.001657 | 0.02375 | -0.06975 | -0.04821 | 0.04489 | fixed |
| sibling_count3 | -0.003215 | 0.03809 | -0.08441 | -0.07787 | 0.07144 | fixed |
| sibling_count4 | -0.01684 | 0.04205 | -0.4004 | -0.09925 | 0.06558 | fixed |
| sibling_count5 | -0.05794 | 0.04916 | -1.179 | -0.1543 | 0.03842 | fixed |
| sibling_count5+ | -0.1653 | 0.05105 | -3.238 | -0.2653 | -0.06523 | fixed |
| sd_(Intercept).mother_pidlink | 0.3836 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.835 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.751 | 0.4073 | -4.3 | -2.549 | -0.953 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2103 | 0.04614 | 4.558 | 0.1199 | 0.3008 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006901 | 0.001646 | -4.193 | -0.01013 | -0.003675 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00007025 | 0.00001864 | 3.769 | 0.00003372 | 0.0001068 | fixed |
| male | -0.001182 | 0.02375 | -0.04974 | -0.04774 | 0.04538 | fixed |
| sibling_count3 | 0.007384 | 0.03885 | 0.1901 | -0.06877 | 0.08353 | fixed |
| sibling_count4 | -0.003047 | 0.04364 | -0.06983 | -0.08858 | 0.08249 | fixed |
| sibling_count5 | -0.04944 | 0.05155 | -0.9591 | -0.1505 | 0.05159 | fixed |
| sibling_count5+ | -0.1575 | 0.05246 | -3.002 | -0.2603 | -0.05469 | fixed |
| birth_order_nonlinear2 | 0.003951 | 0.03053 | 0.1294 | -0.05588 | 0.06379 | fixed |
| birth_order_nonlinear3 | -0.06261 | 0.03762 | -1.664 | -0.1363 | 0.01111 | fixed |
| birth_order_nonlinear4 | -0.03636 | 0.0466 | -0.7802 | -0.1277 | 0.05497 | fixed |
| birth_order_nonlinear5 | -0.007188 | 0.05817 | -0.1236 | -0.1212 | 0.1068 | fixed |
| birth_order_nonlinear5+ | -0.05932 | 0.05891 | -1.007 | -0.1748 | 0.05615 | fixed |
| sd_(Intercept).mother_pidlink | 0.3846 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8348 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.724 | 0.408 | -4.227 | -2.524 | -0.9248 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.205 | 0.04622 | 4.435 | 0.1144 | 0.2956 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0067 | 0.001649 | -4.063 | -0.009932 | -0.003468 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00006785 | 0.00001868 | 3.633 | 0.00003125 | 0.0001045 | fixed |
| male | -0.003637 | 0.02376 | -0.1531 | -0.05021 | 0.04294 | fixed |
| count_birth_order2/2 | 0.06035 | 0.0554 | 1.089 | -0.04823 | 0.1689 | fixed |
| count_birth_order1/3 | 0.04137 | 0.04935 | 0.8382 | -0.05536 | 0.1381 | fixed |
| count_birth_order2/3 | 0.006316 | 0.05378 | 0.1175 | -0.09909 | 0.1117 | fixed |
| count_birth_order3/3 | -0.03376 | 0.05998 | -0.5628 | -0.1513 | 0.08381 | fixed |
| count_birth_order1/4 | -0.03262 | 0.06047 | -0.5395 | -0.1511 | 0.08589 | fixed |
| count_birth_order2/4 | 0.0837 | 0.06257 | 1.338 | -0.03892 | 0.2063 | fixed |
| count_birth_order3/4 | -0.07312 | 0.06565 | -1.114 | -0.2018 | 0.05555 | fixed |
| count_birth_order4/4 | -0.002899 | 0.06845 | -0.04236 | -0.1371 | 0.1313 | fixed |
| count_birth_order1/5 | 0.01161 | 0.08139 | 0.1427 | -0.1479 | 0.1711 | fixed |
| count_birth_order2/5 | -0.07328 | 0.08756 | -0.837 | -0.2449 | 0.09833 | fixed |
| count_birth_order3/5 | -0.1484 | 0.0822 | -1.806 | -0.3096 | 0.01267 | fixed |
| count_birth_order4/5 | -0.03242 | 0.07917 | -0.4095 | -0.1876 | 0.1228 | fixed |
| count_birth_order5/5 | -0.02795 | 0.08174 | -0.342 | -0.1882 | 0.1322 | fixed |
| count_birth_order1/5+ | -0.05036 | 0.0809 | -0.6225 | -0.2089 | 0.1082 | fixed |
| count_birth_order2/5+ | -0.2429 | 0.0813 | -2.987 | -0.4022 | -0.08351 | fixed |
| count_birth_order3/5+ | -0.1141 | 0.08049 | -1.418 | -0.2719 | 0.04363 | fixed |
| count_birth_order4/5+ | -0.227 | 0.07547 | -3.008 | -0.3749 | -0.07911 | fixed |
| count_birth_order5/5+ | -0.1526 | 0.07184 | -2.124 | -0.2934 | -0.01176 | fixed |
| count_birth_order5+/5+ | -0.1988 | 0.05463 | -3.639 | -0.3059 | -0.09173 | fixed |
| sd_(Intercept).mother_pidlink | 0.385 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8344 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 15526 | 15600 | -7752 | 15504 | NA | NA | NA |
| 12 | 15527 | 15607 | -7752 | 15503 | 1.066 | 1 | 0.3018 |
| 16 | 15532 | 15639 | -7750 | 15500 | 3.189 | 4 | 0.5268 |
| 26 | 15540 | 15713 | -7744 | 15488 | 12.37 | 10 | 0.2613 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.735 | 0.4053 | -4.282 | -2.53 | -0.9409 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2105 | 0.04599 | 4.578 | 0.1204 | 0.3006 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006937 | 0.001641 | -4.228 | -0.01015 | -0.003721 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00007079 | 0.00001858 | 3.81 | 0.00003437 | 0.0001072 | fixed |
| male | -0.001301 | 0.02365 | -0.05501 | -0.04766 | 0.04506 | fixed |
| sibling_count3 | -0.03781 | 0.04097 | -0.923 | -0.1181 | 0.04248 | fixed |
| sibling_count4 | -0.007388 | 0.04336 | -0.1704 | -0.09238 | 0.0776 | fixed |
| sibling_count5 | -0.06853 | 0.04634 | -1.479 | -0.1594 | 0.02229 | fixed |
| sibling_count5+ | -0.1464 | 0.04069 | -3.598 | -0.2261 | -0.06664 | fixed |
| sd_(Intercept).mother_pidlink | 0.3853 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8346 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.721 | 0.4053 | -4.247 | -2.516 | -0.927 | fixed |
| birth_order | -0.01171 | 0.006915 | -1.694 | -0.02527 | 0.001839 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2106 | 0.04598 | 4.58 | 0.1205 | 0.3007 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006923 | 0.001641 | -4.22 | -0.01014 | -0.003707 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00007016 | 0.00001858 | 3.776 | 0.00003374 | 0.0001066 | fixed |
| male | -0.0008451 | 0.02365 | -0.03573 | -0.0472 | 0.04551 | fixed |
| sibling_count3 | -0.03205 | 0.04109 | -0.7799 | -0.1126 | 0.04849 | fixed |
| sibling_count4 | 0.005742 | 0.04403 | 0.1304 | -0.08055 | 0.09203 | fixed |
| sibling_count5 | -0.04796 | 0.04788 | -1.002 | -0.1418 | 0.04588 | fixed |
| sibling_count5+ | -0.1033 | 0.04796 | -2.154 | -0.1973 | -0.009283 | fixed |
| sd_(Intercept).mother_pidlink | 0.384 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8349 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.737 | 0.4058 | -4.28 | -2.532 | -0.9414 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2108 | 0.046 | 4.584 | 0.1207 | 0.301 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006929 | 0.001641 | -4.222 | -0.01015 | -0.003712 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00007018 | 0.00001859 | 3.775 | 0.00003374 | 0.0001066 | fixed |
| male | 0.0001426 | 0.02365 | 0.006029 | -0.04621 | 0.0465 | fixed |
| sibling_count3 | -0.02208 | 0.04182 | -0.5281 | -0.104 | 0.05988 | fixed |
| sibling_count4 | 0.0252 | 0.04553 | 0.5535 | -0.06404 | 0.1144 | fixed |
| sibling_count5 | -0.04036 | 0.05006 | -0.8061 | -0.1385 | 0.05777 | fixed |
| sibling_count5+ | -0.08923 | 0.04936 | -1.808 | -0.186 | 0.007504 | fixed |
| birth_order_nonlinear2 | -0.007419 | 0.03111 | -0.2385 | -0.06839 | 0.05355 | fixed |
| birth_order_nonlinear3 | -0.06747 | 0.03749 | -1.8 | -0.1409 | 0.006012 | fixed |
| birth_order_nonlinear4 | -0.08405 | 0.04525 | -1.857 | -0.1728 | 0.004641 | fixed |
| birth_order_nonlinear5 | 0.01327 | 0.05537 | 0.2397 | -0.09524 | 0.1218 | fixed |
| birth_order_nonlinear5+ | -0.1017 | 0.05263 | -1.933 | -0.2049 | 0.001402 | fixed |
| sd_(Intercept).mother_pidlink | 0.3854 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8342 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.753 | 0.4063 | -4.315 | -2.55 | -0.9569 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2086 | 0.04603 | 4.531 | 0.1183 | 0.2988 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006848 | 0.001643 | -4.168 | -0.01007 | -0.003628 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00006923 | 0.00001861 | 3.72 | 0.00003276 | 0.0001057 | fixed |
| male | -0.0008112 | 0.02365 | -0.03431 | -0.04715 | 0.04553 | fixed |
| count_birth_order2/2 | 0.1046 | 0.0606 | 1.727 | -0.01412 | 0.2234 | fixed |
| count_birth_order1/3 | 0.04638 | 0.05345 | 0.8677 | -0.05839 | 0.1511 | fixed |
| count_birth_order2/3 | -0.03838 | 0.05776 | -0.6645 | -0.1516 | 0.07483 | fixed |
| count_birth_order3/3 | -0.04669 | 0.06486 | -0.7199 | -0.1738 | 0.08044 | fixed |
| count_birth_order1/4 | 0.08308 | 0.06328 | 1.313 | -0.04095 | 0.2071 | fixed |
| count_birth_order2/4 | 0.1233 | 0.06453 | 1.91 | -0.003195 | 0.2498 | fixed |
| count_birth_order3/4 | -0.09541 | 0.07025 | -1.358 | -0.2331 | 0.04228 | fixed |
| count_birth_order4/4 | -0.0516 | 0.07268 | -0.71 | -0.194 | 0.09084 | fixed |
| count_birth_order1/5 | -0.01385 | 0.07452 | -0.1859 | -0.1599 | 0.1322 | fixed |
| count_birth_order2/5 | -0.068 | 0.08025 | -0.8473 | -0.2253 | 0.08929 | fixed |
| count_birth_order3/5 | -0.08213 | 0.078 | -1.053 | -0.235 | 0.07074 | fixed |
| count_birth_order4/5 | -0.01231 | 0.08102 | -0.1519 | -0.1711 | 0.1465 | fixed |
| count_birth_order5/5 | 0.02339 | 0.08067 | 0.29 | -0.1347 | 0.1815 | fixed |
| count_birth_order1/5+ | -0.04074 | 0.07093 | -0.5743 | -0.1798 | 0.09829 | fixed |
| count_birth_order2/5+ | -0.1348 | 0.0748 | -1.802 | -0.2814 | 0.01179 | fixed |
| count_birth_order3/5+ | -0.02254 | 0.07276 | -0.3097 | -0.1651 | 0.1201 | fixed |
| count_birth_order4/5+ | -0.1605 | 0.07 | -2.292 | -0.2977 | -0.02327 | fixed |
| count_birth_order5/5+ | -0.04646 | 0.07191 | -0.6462 | -0.1874 | 0.09447 | fixed |
| count_birth_order5+/5+ | -0.1536 | 0.05342 | -2.876 | -0.2583 | -0.04895 | fixed |
| sd_(Intercept).mother_pidlink | 0.3886 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8324 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 15665 | 15738 | -7821 | 15643 | NA | NA | NA |
| 12 | 15664 | 15744 | -7820 | 15640 | 2.876 | 1 | 0.08993 |
| 16 | 15665 | 15772 | -7817 | 15633 | 6.217 | 4 | 0.1835 |
| 26 | 15669 | 15843 | -7809 | 15617 | 16.19 | 10 | 0.09423 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.758 | 0.4107 | -4.281 | -2.563 | -0.9531 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2094 | 0.0466 | 4.494 | 0.1181 | 0.3007 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006886 | 0.001663 | -4.142 | -0.01014 | -0.003627 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00007041 | 0.00001883 | 3.738 | 0.00003349 | 0.0001073 | fixed |
| male | -0.001767 | 0.02395 | -0.07378 | -0.04872 | 0.04518 | fixed |
| sibling_count3 | 0.02318 | 0.03734 | 0.6207 | -0.05001 | 0.09636 | fixed |
| sibling_count4 | -0.01709 | 0.04066 | -0.4203 | -0.09679 | 0.0626 | fixed |
| sibling_count5 | -0.03092 | 0.04791 | -0.6453 | -0.1248 | 0.06299 | fixed |
| sibling_count5+ | -0.1816 | 0.04168 | -4.358 | -0.2633 | -0.09994 | fixed |
| sd_(Intercept).mother_pidlink | 0.3835 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8335 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.751 | 0.4107 | -4.263 | -2.556 | -0.9461 | fixed |
| birth_order | -0.009102 | 0.00815 | -1.117 | -0.02508 | 0.006872 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2099 | 0.0466 | 4.505 | 0.1186 | 0.3012 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006889 | 0.001663 | -4.144 | -0.01015 | -0.003631 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00007008 | 0.00001884 | 3.72 | 0.00003316 | 0.000107 | fixed |
| male | -0.001512 | 0.02396 | -0.06313 | -0.04846 | 0.04544 | fixed |
| sibling_count3 | 0.02767 | 0.03755 | 0.737 | -0.04592 | 0.1013 | fixed |
| sibling_count4 | -0.006581 | 0.04173 | -0.1577 | -0.08836 | 0.0752 | fixed |
| sibling_count5 | -0.01437 | 0.05014 | -0.2867 | -0.1126 | 0.0839 | fixed |
| sibling_count5+ | -0.1474 | 0.05172 | -2.85 | -0.2488 | -0.04602 | fixed |
| sd_(Intercept).mother_pidlink | 0.3829 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8337 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.75 | 0.4113 | -4.255 | -2.556 | -0.9438 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2089 | 0.04663 | 4.48 | 0.1175 | 0.3003 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006853 | 0.001664 | -4.119 | -0.01011 | -0.003592 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00006965 | 0.00001885 | 3.695 | 0.00003271 | 0.0001066 | fixed |
| male | -0.001605 | 0.02396 | -0.06699 | -0.04856 | 0.04535 | fixed |
| sibling_count3 | 0.03932 | 0.03833 | 1.026 | -0.03581 | 0.1144 | fixed |
| sibling_count4 | 0.006506 | 0.04337 | 0.15 | -0.0785 | 0.09151 | fixed |
| sibling_count5 | -0.001042 | 0.05236 | -0.01989 | -0.1037 | 0.1016 | fixed |
| sibling_count5+ | -0.1381 | 0.05322 | -2.595 | -0.2424 | -0.03379 | fixed |
| birth_order_nonlinear2 | -0.01308 | 0.03042 | -0.4302 | -0.0727 | 0.04653 | fixed |
| birth_order_nonlinear3 | -0.06863 | 0.03759 | -1.826 | -0.1423 | 0.005042 | fixed |
| birth_order_nonlinear4 | -0.03461 | 0.04784 | -0.7235 | -0.1284 | 0.05915 | fixed |
| birth_order_nonlinear5 | -0.0511 | 0.06064 | -0.8426 | -0.17 | 0.06776 | fixed |
| birth_order_nonlinear5+ | -0.06211 | 0.06069 | -1.023 | -0.181 | 0.05683 | fixed |
| sd_(Intercept).mother_pidlink | 0.384 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8334 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.72 | 0.4121 | -4.173 | -2.527 | -0.9121 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2027 | 0.04671 | 4.339 | 0.1111 | 0.2942 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006614 | 0.001667 | -3.968 | -0.009881 | -0.003347 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00006677 | 0.00001889 | 3.535 | 0.00002975 | 0.0001038 | fixed |
| male | -0.004393 | 0.02396 | -0.1833 | -0.05136 | 0.04257 | fixed |
| count_birth_order2/2 | 0.05125 | 0.0538 | 0.9527 | -0.05419 | 0.1567 | fixed |
| count_birth_order1/3 | 0.06193 | 0.04865 | 1.273 | -0.03342 | 0.1573 | fixed |
| count_birth_order2/3 | 0.0383 | 0.05364 | 0.7141 | -0.06683 | 0.1434 | fixed |
| count_birth_order3/3 | 0.00373 | 0.05886 | 0.06337 | -0.1116 | 0.1191 | fixed |
| count_birth_order1/4 | 0.008194 | 0.06064 | 0.1351 | -0.1107 | 0.127 | fixed |
| count_birth_order2/4 | 0.05461 | 0.06234 | 0.8759 | -0.06759 | 0.1768 | fixed |
| count_birth_order3/4 | -0.07707 | 0.06483 | -1.189 | -0.2041 | 0.05 | fixed |
| count_birth_order4/4 | 0.01361 | 0.06861 | 0.1983 | -0.1209 | 0.1481 | fixed |
| count_birth_order1/5 | 0.06726 | 0.08109 | 0.8294 | -0.09168 | 0.2262 | fixed |
| count_birth_order2/5 | -0.03652 | 0.09006 | -0.4055 | -0.213 | 0.14 | fixed |
| count_birth_order3/5 | -0.1304 | 0.0861 | -1.515 | -0.2992 | 0.03832 | fixed |
| count_birth_order4/5 | 0.03388 | 0.0827 | 0.4096 | -0.1282 | 0.196 | fixed |
| count_birth_order5/5 | -0.01935 | 0.08732 | -0.2216 | -0.1905 | 0.1518 | fixed |
| count_birth_order1/5+ | -0.01061 | 0.08265 | -0.1284 | -0.1726 | 0.1514 | fixed |
| count_birth_order2/5+ | -0.2631 | 0.08334 | -3.158 | -0.4265 | -0.09981 | fixed |
| count_birth_order3/5+ | -0.07723 | 0.0815 | -0.9476 | -0.237 | 0.08251 | fixed |
| count_birth_order4/5+ | -0.2221 | 0.07927 | -2.802 | -0.3775 | -0.06677 | fixed |
| count_birth_order5/5+ | -0.174 | 0.07346 | -2.368 | -0.318 | -0.03 | fixed |
| count_birth_order5+/5+ | -0.1797 | 0.05555 | -3.235 | -0.2886 | -0.07082 | fixed |
| sd_(Intercept).mother_pidlink | 0.3852 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8326 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 15200 | 15273 | -7589 | 15178 | NA | NA | NA |
| 12 | 15200 | 15280 | -7588 | 15176 | 1.251 | 1 | 0.2634 |
| 16 | 15206 | 15312 | -7587 | 15174 | 2.534 | 4 | 0.6385 |
| 26 | 15211 | 15384 | -7580 | 15159 | 14.26 | 10 | 0.1615 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = words_immediate)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3533 | 0.1522 | 2.322 | 0.05506 | 0.6515 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.006171 | 0.01459 | 0.4228 | -0.02243 | 0.03478 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0004583 | 0.0004298 | -1.066 | -0.001301 | 0.0003842 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000006377 | 0.000003962 | 0.161 | -0.000007128 | 0.000008403 | fixed |
| male | -0.1026 | 0.01588 | -6.461 | -0.1337 | -0.07148 | fixed |
| sibling_count3 | 0.02844 | 0.03284 | 0.8661 | -0.03592 | 0.0928 | fixed |
| sibling_count4 | 0.0288 | 0.03393 | 0.8488 | -0.0377 | 0.0953 | fixed |
| sibling_count5 | -0.005082 | 0.03538 | -0.1436 | -0.07443 | 0.06426 | fixed |
| sibling_count5+ | -0.1109 | 0.02768 | -4.006 | -0.1651 | -0.05663 | fixed |
| sd_(Intercept).mother_pidlink | 0.3956 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8692 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3527 | 0.1522 | 2.318 | 0.05448 | 0.651 | fixed |
| birth_order | -0.002253 | 0.003393 | -0.6641 | -0.008902 | 0.004396 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.006857 | 0.01463 | 0.4687 | -0.02182 | 0.03553 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0004838 | 0.0004315 | -1.121 | -0.00133 | 0.000362 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000008756 | 0.000003978 | 0.2201 | -0.000006921 | 0.000008673 | fixed |
| male | -0.1025 | 0.01588 | -6.457 | -0.1337 | -0.07142 | fixed |
| sibling_count3 | 0.02891 | 0.03285 | 0.8802 | -0.03547 | 0.09329 | fixed |
| sibling_count4 | 0.03031 | 0.034 | 0.8913 | -0.03634 | 0.09695 | fixed |
| sibling_count5 | -0.002406 | 0.03561 | -0.06757 | -0.0722 | 0.06738 | fixed |
| sibling_count5+ | -0.1024 | 0.03047 | -3.361 | -0.1621 | -0.04269 | fixed |
| sd_(Intercept).mother_pidlink | 0.3954 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8693 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3551 | 0.1526 | 2.327 | 0.05601 | 0.6541 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.007002 | 0.01463 | 0.4784 | -0.02168 | 0.03569 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0004887 | 0.0004316 | -1.132 | -0.001335 | 0.0003572 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000009008 | 0.00000398 | 0.2264 | -0.000006899 | 0.000008701 | fixed |
| male | -0.1025 | 0.01588 | -6.451 | -0.1336 | -0.07133 | fixed |
| sibling_count3 | 0.02886 | 0.03328 | 0.8672 | -0.03637 | 0.09408 | fixed |
| sibling_count4 | 0.02953 | 0.0349 | 0.8461 | -0.03887 | 0.09792 | fixed |
| sibling_count5 | -0.00005737 | 0.03689 | -0.001555 | -0.07236 | 0.07224 | fixed |
| sibling_count5+ | -0.09666 | 0.03193 | -3.027 | -0.1592 | -0.03408 | fixed |
| birth_order_nonlinear2 | -0.01544 | 0.02294 | -0.6729 | -0.0604 | 0.02953 | fixed |
| birth_order_nonlinear3 | -0.008737 | 0.02705 | -0.323 | -0.06175 | 0.04428 | fixed |
| birth_order_nonlinear4 | -0.005941 | 0.03082 | -0.1928 | -0.06635 | 0.05446 | fixed |
| birth_order_nonlinear5 | -0.03387 | 0.03506 | -0.9661 | -0.1026 | 0.03485 | fixed |
| birth_order_nonlinear5+ | -0.03147 | 0.02934 | -1.073 | -0.08897 | 0.02603 | fixed |
| sd_(Intercept).mother_pidlink | 0.3954 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8694 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3423 | 0.1532 | 2.234 | 0.04197 | 0.6426 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.007367 | 0.01464 | 0.5033 | -0.02132 | 0.03606 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0005014 | 0.0004317 | -1.161 | -0.001348 | 0.0003448 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000001029 | 0.000003981 | 0.2583 | -0.000006775 | 0.000008832 | fixed |
| male | -0.1027 | 0.01589 | -6.463 | -0.1338 | -0.07155 | fixed |
| count_birth_order2/2 | 0.01152 | 0.04462 | 0.2582 | -0.07594 | 0.09898 | fixed |
| count_birth_order1/3 | 0.03433 | 0.04294 | 0.7994 | -0.04984 | 0.1185 | fixed |
| count_birth_order2/3 | 0.03836 | 0.04795 | 0.8002 | -0.05561 | 0.1323 | fixed |
| count_birth_order3/3 | 0.01806 | 0.05364 | 0.3367 | -0.08707 | 0.1232 | fixed |
| count_birth_order1/4 | 0.009683 | 0.04898 | 0.1977 | -0.08632 | 0.1057 | fixed |
| count_birth_order2/4 | 0.06327 | 0.05141 | 1.231 | -0.03749 | 0.164 | fixed |
| count_birth_order3/4 | 0.0178 | 0.0558 | 0.3189 | -0.09158 | 0.1272 | fixed |
| count_birth_order4/4 | 0.04206 | 0.05908 | 0.7118 | -0.07374 | 0.1579 | fixed |
| count_birth_order1/5 | 0.06302 | 0.05549 | 1.136 | -0.04573 | 0.1718 | fixed |
| count_birth_order2/5 | -0.05377 | 0.05819 | -0.9241 | -0.1678 | 0.06027 | fixed |
| count_birth_order3/5 | -0.02803 | 0.05982 | -0.4686 | -0.1453 | 0.08922 | fixed |
| count_birth_order4/5 | -0.007194 | 0.06332 | -0.1136 | -0.1313 | 0.1169 | fixed |
| count_birth_order5/5 | 0.007012 | 0.06469 | 0.1084 | -0.1198 | 0.1338 | fixed |
| count_birth_order1/5+ | -0.07213 | 0.0447 | -1.614 | -0.1597 | 0.01547 | fixed |
| count_birth_order2/5+ | -0.135 | 0.04606 | -2.931 | -0.2253 | -0.04471 | fixed |
| count_birth_order3/5+ | -0.06838 | 0.04515 | -1.514 | -0.1569 | 0.02012 | fixed |
| count_birth_order4/5+ | -0.09254 | 0.04425 | -2.091 | -0.1793 | -0.005813 | fixed |
| count_birth_order5/5+ | -0.1312 | 0.04458 | -2.943 | -0.2185 | -0.04381 | fixed |
| count_birth_order5+/5+ | -0.1183 | 0.03526 | -3.355 | -0.1874 | -0.04921 | fixed |
| sd_(Intercept).mother_pidlink | 0.3952 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8695 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 38025 | 38108 | -19002 | 38003 | NA | NA | NA |
| 12 | 38027 | 38117 | -19001 | 38003 | 0.4421 | 1 | 0.5061 |
| 16 | 38034 | 38154 | -19001 | 38002 | 1.325 | 4 | 0.8572 |
| 26 | 38046 | 38242 | -18997 | 37994 | 7.138 | 10 | 0.7124 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2703 | 0.4011 | 0.6739 | -0.5158 | 1.056 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0125 | 0.04552 | 0.2745 | -0.07672 | 0.1017 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0003482 | 0.001625 | -0.2144 | -0.003532 | 0.002836 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000000429 | 0.0000184 | 0.02331 | -0.00003564 | 0.00003649 | fixed |
| male | -0.1315 | 0.02342 | -5.616 | -0.1774 | -0.08563 | fixed |
| sibling_count3 | 0.03636 | 0.03708 | 0.9806 | -0.03632 | 0.109 | fixed |
| sibling_count4 | -0.08697 | 0.03999 | -2.175 | -0.1653 | -0.008589 | fixed |
| sibling_count5 | -0.1077 | 0.04571 | -2.357 | -0.1973 | -0.01814 | fixed |
| sibling_count5+ | -0.1732 | 0.04014 | -4.315 | -0.2519 | -0.09454 | fixed |
| sd_(Intercept).mother_pidlink | 0.3506 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8393 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2706 | 0.4012 | 0.6746 | -0.5157 | 1.057 | fixed |
| birth_order | -0.0004093 | 0.007764 | -0.05271 | -0.01563 | 0.01481 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01252 | 0.04552 | 0.2749 | -0.07671 | 0.1017 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0003483 | 0.001625 | -0.2144 | -0.003533 | 0.002836 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000004136 | 0.0000184 | 0.02247 | -0.00003566 | 0.00003649 | fixed |
| male | -0.1315 | 0.02342 | -5.614 | -0.1774 | -0.0856 | fixed |
| sibling_count3 | 0.03656 | 0.03728 | 0.9808 | -0.0365 | 0.1096 | fixed |
| sibling_count4 | -0.08649 | 0.04099 | -2.11 | -0.1668 | -0.006159 | fixed |
| sibling_count5 | -0.107 | 0.04802 | -2.227 | -0.2011 | -0.01284 | fixed |
| sibling_count5+ | -0.1717 | 0.04976 | -3.45 | -0.2692 | -0.07415 | fixed |
| sd_(Intercept).mother_pidlink | 0.3506 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8393 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3012 | 0.4018 | 0.7496 | -0.4863 | 1.089 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01015 | 0.04555 | 0.2228 | -0.07912 | 0.09942 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002567 | 0.001626 | -0.1579 | -0.003443 | 0.002929 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000007896 | 0.00001842 | -0.04287 | -0.00003689 | 0.00003531 | fixed |
| male | -0.1317 | 0.02342 | -5.625 | -0.1777 | -0.08584 | fixed |
| sibling_count3 | 0.03149 | 0.03803 | 0.8279 | -0.04305 | 0.106 | fixed |
| sibling_count4 | -0.08309 | 0.04257 | -1.952 | -0.1665 | 0.0003424 | fixed |
| sibling_count5 | -0.08576 | 0.05042 | -1.701 | -0.1846 | 0.01307 | fixed |
| sibling_count5+ | -0.1567 | 0.05121 | -3.06 | -0.2571 | -0.05632 | fixed |
| birth_order_nonlinear2 | -0.03205 | 0.03018 | -1.062 | -0.0912 | 0.02709 | fixed |
| birth_order_nonlinear3 | 0.02066 | 0.03726 | 0.5544 | -0.05237 | 0.09368 | fixed |
| birth_order_nonlinear4 | -0.04889 | 0.04612 | -1.06 | -0.1393 | 0.0415 | fixed |
| birth_order_nonlinear5 | -0.09808 | 0.05756 | -1.704 | -0.2109 | 0.01473 | fixed |
| birth_order_nonlinear5+ | -0.00781 | 0.05794 | -0.1348 | -0.1214 | 0.1057 | fixed |
| sd_(Intercept).mother_pidlink | 0.3513 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8389 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.326 | 0.4027 | 0.8094 | -0.4633 | 1.115 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.007183 | 0.04565 | 0.1573 | -0.08229 | 0.09665 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001525 | 0.00163 | -0.09357 | -0.003346 | 0.003041 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00000193 | 0.00001846 | -0.1045 | -0.00003812 | 0.00003426 | fixed |
| male | -0.1314 | 0.02344 | -5.606 | -0.1774 | -0.08548 | fixed |
| count_birth_order2/2 | -0.02869 | 0.05464 | -0.5251 | -0.1358 | 0.0784 | fixed |
| count_birth_order1/3 | 0.03888 | 0.04861 | 0.7998 | -0.0564 | 0.1342 | fixed |
| count_birth_order2/3 | 0.0252 | 0.05306 | 0.475 | -0.0788 | 0.1292 | fixed |
| count_birth_order3/3 | 0.006071 | 0.05925 | 0.1025 | -0.1101 | 0.1222 | fixed |
| count_birth_order1/4 | -0.09194 | 0.05943 | -1.547 | -0.2084 | 0.02455 | fixed |
| count_birth_order2/4 | -0.1157 | 0.0614 | -1.883 | -0.236 | 0.004696 | fixed |
| count_birth_order3/4 | -0.0483 | 0.06482 | -0.7451 | -0.1754 | 0.07875 | fixed |
| count_birth_order4/4 | -0.1287 | 0.06748 | -1.907 | -0.261 | 0.003563 | fixed |
| count_birth_order1/5 | -0.1045 | 0.08064 | -1.296 | -0.2625 | 0.05355 | fixed |
| count_birth_order2/5 | -0.07683 | 0.08625 | -0.8907 | -0.2459 | 0.09223 | fixed |
| count_birth_order3/5 | -0.06136 | 0.08085 | -0.7589 | -0.2198 | 0.09711 | fixed |
| count_birth_order4/5 | -0.1804 | 0.0779 | -2.316 | -0.3331 | -0.02774 | fixed |
| count_birth_order5/5 | -0.1471 | 0.08104 | -1.816 | -0.306 | 0.01169 | fixed |
| count_birth_order1/5+ | -0.1353 | 0.07997 | -1.692 | -0.2921 | 0.02142 | fixed |
| count_birth_order2/5+ | -0.2916 | 0.07915 | -3.684 | -0.4467 | -0.1365 | fixed |
| count_birth_order3/5+ | -0.06251 | 0.07924 | -0.7889 | -0.2178 | 0.09279 | fixed |
| count_birth_order4/5+ | -0.1658 | 0.07465 | -2.221 | -0.3121 | -0.01951 | fixed |
| count_birth_order5/5+ | -0.2781 | 0.07055 | -3.942 | -0.4164 | -0.1399 | fixed |
| count_birth_order5+/5+ | -0.1635 | 0.05347 | -3.058 | -0.2683 | -0.05874 | fixed |
| sd_(Intercept).mother_pidlink | 0.3506 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8395 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 15660 | 15733 | -7819 | 15638 | NA | NA | NA |
| 12 | 15662 | 15742 | -7819 | 15638 | 0.002809 | 1 | 0.9577 |
| 16 | 15664 | 15771 | -7816 | 15632 | 6.129 | 4 | 0.1897 |
| 26 | 15677 | 15851 | -7813 | 15625 | 6.632 | 10 | 0.7597 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3023 | 0.4002 | 0.7553 | -0.4821 | 1.087 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.00985 | 0.04544 | 0.2168 | -0.0792 | 0.0989 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002896 | 0.001622 | -0.1786 | -0.003469 | 0.00289 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000002249 | 0.00001838 | -0.01224 | -0.00003624 | 0.00003579 | fixed |
| male | -0.1318 | 0.02335 | -5.645 | -0.1775 | -0.08603 | fixed |
| sibling_count3 | 0.03106 | 0.04014 | 0.7739 | -0.04761 | 0.1097 | fixed |
| sibling_count4 | -0.06748 | 0.04232 | -1.595 | -0.1504 | 0.01547 | fixed |
| sibling_count5 | -0.05013 | 0.04535 | -1.105 | -0.139 | 0.03875 | fixed |
| sibling_count5+ | -0.1294 | 0.03973 | -3.257 | -0.2073 | -0.05154 | fixed |
| sd_(Intercept).mother_pidlink | 0.3519 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8397 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3119 | 0.4003 | 0.7792 | -0.4726 | 1.096 | fixed |
| birth_order | -0.008494 | 0.00679 | -1.251 | -0.0218 | 0.004814 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.009959 | 0.04544 | 0.2192 | -0.07909 | 0.09901 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002798 | 0.001622 | -0.1725 | -0.003459 | 0.002899 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000006759 | 0.00001838 | -0.03678 | -0.0000367 | 0.00003534 | fixed |
| male | -0.1315 | 0.02335 | -5.631 | -0.1772 | -0.08571 | fixed |
| sibling_count3 | 0.03519 | 0.04027 | 0.8737 | -0.04375 | 0.1141 | fixed |
| sibling_count4 | -0.05807 | 0.04298 | -1.351 | -0.1423 | 0.02617 | fixed |
| sibling_count5 | -0.03529 | 0.04687 | -0.7529 | -0.1272 | 0.05658 | fixed |
| sibling_count5+ | -0.09817 | 0.04692 | -2.092 | -0.1901 | -0.006204 | fixed |
| sd_(Intercept).mother_pidlink | 0.3517 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8398 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3142 | 0.4008 | 0.7839 | -0.4713 | 1.1 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.009226 | 0.04545 | 0.203 | -0.07986 | 0.09831 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002426 | 0.001623 | -0.1495 | -0.003423 | 0.002938 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001365 | 0.00001839 | -0.07425 | -0.00003741 | 0.00003468 | fixed |
| male | -0.1316 | 0.02335 | -5.636 | -0.1774 | -0.08583 | fixed |
| sibling_count3 | 0.03017 | 0.04099 | 0.7361 | -0.05017 | 0.1105 | fixed |
| sibling_count4 | -0.05283 | 0.04447 | -1.188 | -0.14 | 0.03434 | fixed |
| sibling_count5 | -0.02045 | 0.04908 | -0.4166 | -0.1167 | 0.07576 | fixed |
| sibling_count5+ | -0.07574 | 0.04836 | -1.566 | -0.1705 | 0.01904 | fixed |
| birth_order_nonlinear2 | -0.02291 | 0.03076 | -0.7446 | -0.0832 | 0.03739 | fixed |
| birth_order_nonlinear3 | 0.00622 | 0.03718 | 0.1673 | -0.06665 | 0.07909 | fixed |
| birth_order_nonlinear4 | -0.07617 | 0.04479 | -1.701 | -0.164 | 0.01162 | fixed |
| birth_order_nonlinear5 | -0.09325 | 0.05494 | -1.697 | -0.2009 | 0.01442 | fixed |
| birth_order_nonlinear5+ | -0.09131 | 0.05184 | -1.761 | -0.1929 | 0.01029 | fixed |
| sd_(Intercept).mother_pidlink | 0.353 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8392 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3186 | 0.4016 | 0.7935 | -0.4684 | 1.106 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.00678 | 0.04552 | 0.1489 | -0.08245 | 0.096 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001478 | 0.001626 | -0.09093 | -0.003334 | 0.003038 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000002497 | 0.00001842 | -0.1355 | -0.00003861 | 0.00003361 | fixed |
| male | -0.1314 | 0.02337 | -5.623 | -0.1772 | -0.08558 | fixed |
| count_birth_order2/2 | 0.02163 | 0.05991 | 0.361 | -0.09579 | 0.139 | fixed |
| count_birth_order1/3 | 0.05145 | 0.05267 | 0.9768 | -0.05178 | 0.1547 | fixed |
| count_birth_order2/3 | 0.03833 | 0.05711 | 0.6712 | -0.0736 | 0.1503 | fixed |
| count_birth_order3/3 | 0.01506 | 0.06423 | 0.2345 | -0.1108 | 0.1409 | fixed |
| count_birth_order1/4 | -0.06686 | 0.06228 | -1.073 | -0.1889 | 0.05522 | fixed |
| count_birth_order2/4 | -0.05847 | 0.06323 | -0.9247 | -0.1824 | 0.06546 | fixed |
| count_birth_order3/4 | -0.03496 | 0.06945 | -0.5034 | -0.1711 | 0.1012 | fixed |
| count_birth_order4/4 | -0.06921 | 0.07172 | -0.965 | -0.2098 | 0.07136 | fixed |
| count_birth_order1/5 | 0.02871 | 0.07388 | 0.3886 | -0.1161 | 0.1735 | fixed |
| count_birth_order2/5 | 0.0003236 | 0.07927 | 0.004082 | -0.155 | 0.1557 | fixed |
| count_birth_order3/5 | -0.009014 | 0.07708 | -0.1169 | -0.1601 | 0.1421 | fixed |
| count_birth_order4/5 | -0.09693 | 0.07987 | -1.214 | -0.2535 | 0.05961 | fixed |
| count_birth_order5/5 | -0.1483 | 0.08009 | -1.851 | -0.3052 | 0.008712 | fixed |
| count_birth_order1/5+ | -0.02559 | 0.07021 | -0.3644 | -0.1632 | 0.112 | fixed |
| count_birth_order2/5+ | -0.1887 | 0.07328 | -2.575 | -0.3324 | -0.04509 | fixed |
| count_birth_order3/5+ | 0.00315 | 0.07175 | 0.04391 | -0.1375 | 0.1438 | fixed |
| count_birth_order4/5+ | -0.1667 | 0.06916 | -2.41 | -0.3023 | -0.03115 | fixed |
| count_birth_order5/5+ | -0.1191 | 0.07104 | -1.676 | -0.2583 | 0.02015 | fixed |
| count_birth_order5+/5+ | -0.1524 | 0.0524 | -2.909 | -0.2551 | -0.04972 | fixed |
| sd_(Intercept).mother_pidlink | 0.3507 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8402 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 15806 | 15880 | -7892 | 15784 | NA | NA | NA |
| 12 | 15807 | 15887 | -7891 | 15783 | 1.568 | 1 | 0.2105 |
| 16 | 15810 | 15917 | -7889 | 15778 | 5.324 | 4 | 0.2556 |
| 26 | 15821 | 15996 | -7885 | 15769 | 8.136 | 10 | 0.6156 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2817 | 0.4058 | 0.6942 | -0.5136 | 1.077 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0102 | 0.04607 | 0.2214 | -0.08009 | 0.1005 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002244 | 0.001645 | -0.1364 | -0.003448 | 0.002999 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001458 | 0.00001864 | -0.0782 | -0.00003799 | 0.00003507 | fixed |
| male | -0.127 | 0.02366 | -5.368 | -0.1734 | -0.08062 | fixed |
| sibling_count3 | 0.01622 | 0.03661 | 0.443 | -0.05554 | 0.08798 | fixed |
| sibling_count4 | -0.08336 | 0.03974 | -2.098 | -0.1612 | -0.005483 | fixed |
| sibling_count5 | -0.1066 | 0.04688 | -2.274 | -0.1985 | -0.01472 | fixed |
| sibling_count5+ | -0.1814 | 0.04062 | -4.467 | -0.261 | -0.1018 | fixed |
| sd_(Intercept).mother_pidlink | 0.3519 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8386 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2826 | 0.4058 | 0.6965 | -0.5128 | 1.078 | fixed |
| birth_order | -0.001434 | 0.007998 | -0.1793 | -0.01711 | 0.01424 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01029 | 0.04608 | 0.2234 | -0.08001 | 0.1006 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002252 | 0.001645 | -0.1369 | -0.003449 | 0.002999 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001507 | 0.00001864 | -0.08082 | -0.00003805 | 0.00003503 | fixed |
| male | -0.127 | 0.02366 | -5.365 | -0.1733 | -0.08058 | fixed |
| sibling_count3 | 0.01692 | 0.03683 | 0.4595 | -0.05525 | 0.0891 | fixed |
| sibling_count4 | -0.08173 | 0.04077 | -2.005 | -0.1616 | -0.001818 | fixed |
| sibling_count5 | -0.104 | 0.04907 | -2.12 | -0.2002 | -0.007835 | fixed |
| sibling_count5+ | -0.1761 | 0.05051 | -3.486 | -0.2751 | -0.07706 | fixed |
| sd_(Intercept).mother_pidlink | 0.3519 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8387 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3087 | 0.4063 | 0.7598 | -0.4876 | 1.105 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.008334 | 0.04608 | 0.1809 | -0.08199 | 0.09866 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001465 | 0.001645 | -0.08904 | -0.003371 | 0.003078 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000002585 | 0.00001865 | -0.1386 | -0.00003914 | 0.00003397 | fixed |
| male | -0.1268 | 0.02365 | -5.361 | -0.1732 | -0.08045 | fixed |
| sibling_count3 | 0.007929 | 0.03761 | 0.2108 | -0.06578 | 0.08164 | fixed |
| sibling_count4 | -0.08449 | 0.04241 | -1.992 | -0.1676 | -0.001375 | fixed |
| sibling_count5 | -0.08849 | 0.05131 | -1.724 | -0.1891 | 0.01209 | fixed |
| sibling_count5+ | -0.1624 | 0.05206 | -3.12 | -0.2644 | -0.06038 | fixed |
| birth_order_nonlinear2 | -0.03418 | 0.03009 | -1.136 | -0.09315 | 0.0248 | fixed |
| birth_order_nonlinear3 | 0.03246 | 0.03725 | 0.8714 | -0.04054 | 0.1055 | fixed |
| birth_order_nonlinear4 | -0.04026 | 0.04743 | -0.8487 | -0.1332 | 0.05271 | fixed |
| birth_order_nonlinear5 | -0.1089 | 0.06002 | -1.814 | -0.2265 | 0.008782 | fixed |
| birth_order_nonlinear5+ | -0.01919 | 0.05976 | -0.3212 | -0.1363 | 0.09792 | fixed |
| sd_(Intercept).mother_pidlink | 0.3542 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8375 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3267 | 0.4074 | 0.8019 | -0.4718 | 1.125 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.006268 | 0.04621 | 0.1357 | -0.08429 | 0.09683 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00007614 | 0.00165 | -0.04615 | -0.00331 | 0.003158 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000003334 | 0.0000187 | -0.1783 | -0.00003999 | 0.00003333 | fixed |
| male | -0.1272 | 0.02368 | -5.373 | -0.1736 | -0.08082 | fixed |
| count_birth_order2/2 | -0.03157 | 0.05319 | -0.5935 | -0.1358 | 0.07268 | fixed |
| count_birth_order1/3 | 0.00815 | 0.04803 | 0.1697 | -0.08598 | 0.1023 | fixed |
| count_birth_order2/3 | -0.003243 | 0.05303 | -0.06115 | -0.1072 | 0.1007 | fixed |
| count_birth_order3/3 | 0.01332 | 0.0582 | 0.2289 | -0.1007 | 0.1274 | fixed |
| count_birth_order1/4 | -0.07328 | 0.05972 | -1.227 | -0.1903 | 0.04377 | fixed |
| count_birth_order2/4 | -0.1149 | 0.0613 | -1.874 | -0.235 | 0.005281 | fixed |
| count_birth_order3/4 | -0.05864 | 0.06415 | -0.9141 | -0.1844 | 0.06709 | fixed |
| count_birth_order4/4 | -0.1343 | 0.06788 | -1.978 | -0.2673 | -0.001241 | fixed |
| count_birth_order1/5 | -0.112 | 0.08048 | -1.391 | -0.2697 | 0.04577 | fixed |
| count_birth_order2/5 | -0.09691 | 0.08883 | -1.091 | -0.271 | 0.07719 | fixed |
| count_birth_order3/5 | -0.05437 | 0.08475 | -0.6416 | -0.2205 | 0.1117 | fixed |
| count_birth_order4/5 | -0.1419 | 0.08168 | -1.738 | -0.302 | 0.01816 | fixed |
| count_birth_order5/5 | -0.174 | 0.08675 | -2.006 | -0.344 | -0.003991 | fixed |
| count_birth_order1/5+ | -0.1511 | 0.08185 | -1.846 | -0.3115 | 0.009357 | fixed |
| count_birth_order2/5+ | -0.2914 | 0.08114 | -3.591 | -0.4504 | -0.1324 | fixed |
| count_birth_order3/5+ | -0.05562 | 0.08034 | -0.6923 | -0.2131 | 0.1019 | fixed |
| count_birth_order4/5+ | -0.1748 | 0.07855 | -2.226 | -0.3288 | -0.02089 | fixed |
| count_birth_order5/5+ | -0.2837 | 0.07222 | -3.929 | -0.4253 | -0.1422 | fixed |
| count_birth_order5+/5+ | -0.1808 | 0.05448 | -3.319 | -0.2876 | -0.07403 | fixed |
| sd_(Intercept).mother_pidlink | 0.3538 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8382 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 15343 | 15417 | -7661 | 15321 | NA | NA | NA |
| 12 | 15345 | 15425 | -7661 | 15321 | 0.03222 | 1 | 0.8575 |
| 16 | 15346 | 15453 | -7657 | 15314 | 7.259 | 4 | 0.1228 |
| 26 | 15362 | 15535 | -7655 | 15310 | 4.273 | 10 | 0.9342 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = words_delayed)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.309 | 0.1522 | 2.03 | 0.01067 | 0.6073 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01178 | 0.0146 | 0.8074 | -0.01682 | 0.04039 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0006651 | 0.0004297 | -1.548 | -0.001507 | 0.0001771 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000001695 | 0.00000396 | 0.4279 | -0.000006066 | 0.000009455 | fixed |
| male | -0.07984 | 0.01592 | -5.015 | -0.111 | -0.04864 | fixed |
| sibling_count3 | 0.05182 | 0.03269 | 1.585 | -0.01226 | 0.1159 | fixed |
| sibling_count4 | 0.03874 | 0.03375 | 1.148 | -0.02741 | 0.1049 | fixed |
| sibling_count5 | 0.007162 | 0.03517 | 0.2037 | -0.06176 | 0.07609 | fixed |
| sibling_count5+ | -0.06697 | 0.02754 | -2.432 | -0.1209 | -0.01299 | fixed |
| sd_(Intercept).mother_pidlink | 0.3767 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8767 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3084 | 0.1522 | 2.026 | 0.01012 | 0.6068 | fixed |
| birth_order | -0.001883 | 0.003389 | -0.5557 | -0.008525 | 0.004759 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01235 | 0.01463 | 0.8444 | -0.01632 | 0.04103 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0006861 | 0.0004314 | -1.591 | -0.001532 | 0.0001594 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00000189 | 0.000003975 | 0.4754 | -0.000005902 | 0.000009681 | fixed |
| male | -0.07979 | 0.01592 | -5.012 | -0.111 | -0.04858 | fixed |
| sibling_count3 | 0.05222 | 0.0327 | 1.597 | -0.01188 | 0.1163 | fixed |
| sibling_count4 | 0.04001 | 0.03383 | 1.183 | -0.02629 | 0.1063 | fixed |
| sibling_count5 | 0.00941 | 0.0354 | 0.2658 | -0.05997 | 0.07879 | fixed |
| sibling_count5+ | -0.05988 | 0.03035 | -1.973 | -0.1194 | -0.0003944 | fixed |
| sd_(Intercept).mother_pidlink | 0.3766 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8767 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3002 | 0.1526 | 1.967 | 0.001069 | 0.5993 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01267 | 0.01463 | 0.8656 | -0.01602 | 0.04135 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0007038 | 0.0004314 | -1.631 | -0.001549 | 0.0001418 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000002105 | 0.000003976 | 0.5294 | -0.000005689 | 0.000009899 | fixed |
| male | -0.07975 | 0.01592 | -5.009 | -0.111 | -0.04854 | fixed |
| sibling_count3 | 0.054 | 0.03314 | 1.63 | -0.01095 | 0.119 | fixed |
| sibling_count4 | 0.03784 | 0.03474 | 1.089 | -0.03024 | 0.1059 | fixed |
| sibling_count5 | 0.00649 | 0.03669 | 0.1769 | -0.06543 | 0.07841 | fixed |
| sibling_count5+ | -0.05398 | 0.03183 | -1.696 | -0.1164 | 0.008402 | fixed |
| birth_order_nonlinear2 | 0.01565 | 0.02303 | 0.6794 | -0.02949 | 0.06078 | fixed |
| birth_order_nonlinear3 | -0.008068 | 0.02716 | -0.2971 | -0.0613 | 0.04516 | fixed |
| birth_order_nonlinear4 | 0.01986 | 0.03094 | 0.6418 | -0.04079 | 0.08051 | fixed |
| birth_order_nonlinear5 | 0.005391 | 0.0352 | 0.1531 | -0.06361 | 0.07439 | fixed |
| birth_order_nonlinear5+ | -0.02652 | 0.02938 | -0.9024 | -0.0841 | 0.03107 | fixed |
| sd_(Intercept).mother_pidlink | 0.3763 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8769 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2999 | 0.1533 | 1.957 | -0.0005013 | 0.6003 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0129 | 0.01464 | 0.8813 | -0.01579 | 0.04159 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0007085 | 0.0004316 | -1.642 | -0.001554 | 0.0001374 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000002131 | 0.000003979 | 0.5357 | -0.000005667 | 0.000009929 | fixed |
| male | -0.07974 | 0.01593 | -5.007 | -0.111 | -0.04853 | fixed |
| count_birth_order2/2 | 0.008045 | 0.04478 | 0.1796 | -0.07973 | 0.09582 | fixed |
| count_birth_order1/3 | 0.06475 | 0.04293 | 1.508 | -0.01939 | 0.1489 | fixed |
| count_birth_order2/3 | 0.05148 | 0.04795 | 1.074 | -0.0425 | 0.1455 | fixed |
| count_birth_order3/3 | 0.03626 | 0.05366 | 0.6758 | -0.06891 | 0.1414 | fixed |
| count_birth_order1/4 | 0.006214 | 0.04899 | 0.1268 | -0.0898 | 0.1022 | fixed |
| count_birth_order2/4 | 0.1041 | 0.05142 | 2.024 | 0.003272 | 0.2048 | fixed |
| count_birth_order3/4 | 0.02208 | 0.05583 | 0.3954 | -0.08735 | 0.1315 | fixed |
| count_birth_order4/4 | 0.03046 | 0.05912 | 0.5152 | -0.08542 | 0.1463 | fixed |
| count_birth_order1/5 | -0.04227 | 0.05551 | -0.7614 | -0.1511 | 0.06654 | fixed |
| count_birth_order2/5 | 0.02579 | 0.05822 | 0.4429 | -0.08833 | 0.1399 | fixed |
| count_birth_order3/5 | -0.005886 | 0.05987 | -0.09831 | -0.1232 | 0.1115 | fixed |
| count_birth_order4/5 | 0.03416 | 0.06337 | 0.539 | -0.09005 | 0.1584 | fixed |
| count_birth_order5/5 | 0.06224 | 0.06476 | 0.9611 | -0.06468 | 0.1892 | fixed |
| count_birth_order1/5+ | -0.03199 | 0.04473 | -0.7153 | -0.1197 | 0.05568 | fixed |
| count_birth_order2/5+ | -0.06433 | 0.0461 | -1.395 | -0.1547 | 0.02603 | fixed |
| count_birth_order3/5+ | -0.058 | 0.0452 | -1.283 | -0.1466 | 0.03059 | fixed |
| count_birth_order4/5+ | -0.03051 | 0.04429 | -0.6888 | -0.1173 | 0.0563 | fixed |
| count_birth_order5/5+ | -0.06936 | 0.04462 | -1.554 | -0.1568 | 0.0181 | fixed |
| count_birth_order5+/5+ | -0.08347 | 0.0352 | -2.372 | -0.1525 | -0.01449 | fixed |
| sd_(Intercept).mother_pidlink | 0.3767 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8769 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 38051 | 38134 | -19015 | 38029 | NA | NA | NA |
| 12 | 38053 | 38143 | -19014 | 38029 | 0.3095 | 1 | 0.578 |
| 16 | 38058 | 38179 | -19013 | 38026 | 2.904 | 4 | 0.574 |
| 26 | 38072 | 38268 | -19010 | 38020 | 6.247 | 10 | 0.7941 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5229 | 0.4116 | 1.27 | -0.2838 | 1.33 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01788 | 0.04671 | -0.3827 | -0.1094 | 0.07368 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0007731 | 0.001667 | 0.4637 | -0.002495 | 0.004041 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001439 | 0.00001888 | -0.762 | -0.0000514 | 0.00002262 | fixed |
| male | -0.115 | 0.02403 | -4.784 | -0.1621 | -0.06786 | fixed |
| sibling_count3 | 0.0267 | 0.03804 | 0.7019 | -0.04786 | 0.1013 | fixed |
| sibling_count4 | -0.04166 | 0.04102 | -1.016 | -0.1221 | 0.03873 | fixed |
| sibling_count5 | -0.06095 | 0.04688 | -1.3 | -0.1528 | 0.03094 | fixed |
| sibling_count5+ | -0.09835 | 0.04118 | -2.388 | -0.179 | -0.01764 | fixed |
| sd_(Intercept).mother_pidlink | 0.3583 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8618 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5171 | 0.4117 | 1.256 | -0.2897 | 1.324 | fixed |
| birth_order | 0.007062 | 0.007967 | 0.8865 | -0.008552 | 0.02268 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01823 | 0.04672 | -0.3902 | -0.1098 | 0.07333 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0007744 | 0.001667 | 0.4645 | -0.002493 | 0.004042 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001412 | 0.00001889 | -0.7477 | -0.00005114 | 0.00002289 | fixed |
| male | -0.1153 | 0.02404 | -4.796 | -0.1624 | -0.06818 | fixed |
| sibling_count3 | 0.02326 | 0.03824 | 0.6082 | -0.05169 | 0.09821 | fixed |
| sibling_count4 | -0.04983 | 0.04204 | -1.185 | -0.1322 | 0.03258 | fixed |
| sibling_count5 | -0.07432 | 0.04925 | -1.509 | -0.1709 | 0.02221 | fixed |
| sibling_count5+ | -0.1251 | 0.05104 | -2.451 | -0.2251 | -0.02505 | fixed |
| sd_(Intercept).mother_pidlink | 0.3584 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8618 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.519 | 0.4125 | 1.258 | -0.2896 | 1.327 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01781 | 0.04676 | -0.3809 | -0.1095 | 0.07385 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0007623 | 0.001669 | 0.4567 | -0.002509 | 0.004034 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001408 | 0.00001891 | -0.7446 | -0.00005114 | 0.00002298 | fixed |
| male | -0.115 | 0.02405 | -4.78 | -0.1621 | -0.06782 | fixed |
| sibling_count3 | 0.02667 | 0.03902 | 0.6834 | -0.04981 | 0.1031 | fixed |
| sibling_count4 | -0.04087 | 0.04367 | -0.9359 | -0.1265 | 0.04472 | fixed |
| sibling_count5 | -0.05821 | 0.05172 | -1.125 | -0.1596 | 0.04317 | fixed |
| sibling_count5+ | -0.1119 | 0.05254 | -2.13 | -0.2149 | -0.008957 | fixed |
| birth_order_nonlinear2 | 0.01206 | 0.031 | 0.3889 | -0.0487 | 0.07281 | fixed |
| birth_order_nonlinear3 | 0.0001107 | 0.03827 | 0.002894 | -0.07489 | 0.07512 | fixed |
| birth_order_nonlinear4 | -0.003256 | 0.04736 | -0.06875 | -0.09609 | 0.08958 | fixed |
| birth_order_nonlinear5 | -0.004436 | 0.05912 | -0.07503 | -0.1203 | 0.1114 | fixed |
| birth_order_nonlinear5+ | 0.04355 | 0.05949 | 0.7321 | -0.07304 | 0.1601 | fixed |
| sd_(Intercept).mother_pidlink | 0.3573 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8625 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5809 | 0.4133 | 1.406 | -0.2291 | 1.391 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.02288 | 0.04685 | -0.4885 | -0.1147 | 0.06894 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0009401 | 0.001672 | 0.5622 | -0.002338 | 0.004218 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001602 | 0.00001895 | -0.8455 | -0.00005316 | 0.00002112 | fixed |
| male | -0.115 | 0.02406 | -4.778 | -0.1621 | -0.06781 | fixed |
| count_birth_order2/2 | -0.03987 | 0.0561 | -0.7107 | -0.1498 | 0.07008 | fixed |
| count_birth_order1/3 | 0.01812 | 0.04988 | 0.3633 | -0.07964 | 0.1159 | fixed |
| count_birth_order2/3 | 0.03543 | 0.05445 | 0.6507 | -0.07129 | 0.1422 | fixed |
| count_birth_order3/3 | -0.0276 | 0.06081 | -0.4539 | -0.1468 | 0.09158 | fixed |
| count_birth_order1/4 | -0.09582 | 0.06099 | -1.571 | -0.2154 | 0.02371 | fixed |
| count_birth_order2/4 | 0.009069 | 0.06301 | 0.1439 | -0.1144 | 0.1326 | fixed |
| count_birth_order3/4 | -0.06621 | 0.06652 | -0.9952 | -0.1966 | 0.06418 | fixed |
| count_birth_order4/4 | -0.06907 | 0.06925 | -0.9974 | -0.2048 | 0.06666 | fixed |
| count_birth_order1/5 | -0.1395 | 0.08275 | -1.686 | -0.3017 | 0.02266 | fixed |
| count_birth_order2/5 | -0.03975 | 0.08852 | -0.4491 | -0.2132 | 0.1337 | fixed |
| count_birth_order3/5 | -0.08459 | 0.08298 | -1.019 | -0.2472 | 0.07805 | fixed |
| count_birth_order4/5 | -0.1223 | 0.07995 | -1.53 | -0.279 | 0.03438 | fixed |
| count_birth_order5/5 | 0.02383 | 0.08317 | 0.2865 | -0.1392 | 0.1868 | fixed |
| count_birth_order1/5+ | -0.1065 | 0.08207 | -1.298 | -0.2674 | 0.05433 | fixed |
| count_birth_order2/5+ | -0.199 | 0.08123 | -2.45 | -0.3582 | -0.03983 | fixed |
| count_birth_order3/5+ | -0.03194 | 0.08132 | -0.3928 | -0.1913 | 0.1274 | fixed |
| count_birth_order4/5+ | -0.08364 | 0.07662 | -1.092 | -0.2338 | 0.06653 | fixed |
| count_birth_order5/5+ | -0.2049 | 0.0724 | -2.831 | -0.3469 | -0.06304 | fixed |
| count_birth_order5+/5+ | -0.08616 | 0.05485 | -1.571 | -0.1937 | 0.02135 | fixed |
| sd_(Intercept).mother_pidlink | 0.3559 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8628 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 15967 | 16040 | -7972 | 15945 | NA | NA | NA |
| 12 | 15968 | 16048 | -7972 | 15944 | 0.7869 | 1 | 0.375 |
| 16 | 15976 | 16083 | -7972 | 15944 | 0.1261 | 4 | 0.9981 |
| 26 | 15984 | 16158 | -7966 | 15932 | 11.94 | 10 | 0.2889 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5618 | 0.4105 | 1.368 | -0.2428 | 1.366 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.02052 | 0.04661 | -0.4403 | -0.1119 | 0.07083 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0008411 | 0.001664 | 0.5055 | -0.00242 | 0.004102 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000151 | 0.00001885 | -0.801 | -0.00005204 | 0.00002184 | fixed |
| male | -0.117 | 0.02395 | -4.887 | -0.164 | -0.07011 | fixed |
| sibling_count3 | 0.01493 | 0.04115 | 0.3629 | -0.06573 | 0.09559 | fixed |
| sibling_count4 | -0.04601 | 0.04339 | -1.061 | -0.131 | 0.03902 | fixed |
| sibling_count5 | -0.007199 | 0.04649 | -0.1548 | -0.09832 | 0.08392 | fixed |
| sibling_count5+ | -0.08743 | 0.04073 | -2.147 | -0.1673 | -0.007599 | fixed |
| sd_(Intercept).mother_pidlink | 0.3588 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8621 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5616 | 0.4106 | 1.368 | -0.2432 | 1.366 | fixed |
| birth_order | 0.000166 | 0.006964 | 0.02383 | -0.01348 | 0.01382 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.02052 | 0.04661 | -0.4403 | -0.1119 | 0.07084 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0008408 | 0.001664 | 0.5053 | -0.002421 | 0.004102 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001509 | 0.00001885 | -0.8003 | -0.00005204 | 0.00002186 | fixed |
| male | -0.1171 | 0.02395 | -4.887 | -0.164 | -0.07011 | fixed |
| sibling_count3 | 0.01485 | 0.0413 | 0.3596 | -0.06609 | 0.09579 | fixed |
| sibling_count4 | -0.0462 | 0.04407 | -1.048 | -0.1326 | 0.04018 | fixed |
| sibling_count5 | -0.007488 | 0.04806 | -0.1558 | -0.1017 | 0.08671 | fixed |
| sibling_count5+ | -0.08804 | 0.04811 | -1.83 | -0.1823 | 0.006261 | fixed |
| sd_(Intercept).mother_pidlink | 0.3589 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8622 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5356 | 0.4112 | 1.302 | -0.2704 | 1.342 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01871 | 0.04664 | -0.4011 | -0.1101 | 0.07271 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0007845 | 0.001665 | 0.4711 | -0.002479 | 0.004048 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001472 | 0.00001887 | -0.7799 | -0.0000517 | 0.00002227 | fixed |
| male | -0.1163 | 0.02396 | -4.853 | -0.1632 | -0.06932 | fixed |
| sibling_count3 | 0.01644 | 0.04204 | 0.3912 | -0.06595 | 0.09883 | fixed |
| sibling_count4 | -0.03607 | 0.0456 | -0.7909 | -0.1254 | 0.05331 | fixed |
| sibling_count5 | 0.00655 | 0.05033 | 0.1302 | -0.09209 | 0.1052 | fixed |
| sibling_count5+ | -0.05999 | 0.04958 | -1.21 | -0.1572 | 0.03719 | fixed |
| birth_order_nonlinear2 | 0.03067 | 0.03158 | 0.9712 | -0.03123 | 0.09257 | fixed |
| birth_order_nonlinear3 | -0.00388 | 0.03816 | -0.1017 | -0.07868 | 0.07092 | fixed |
| birth_order_nonlinear4 | -0.03289 | 0.04598 | -0.7153 | -0.123 | 0.05723 | fixed |
| birth_order_nonlinear5 | -0.004899 | 0.05639 | -0.08687 | -0.1154 | 0.1056 | fixed |
| birth_order_nonlinear5+ | -0.03593 | 0.05319 | -0.6756 | -0.1402 | 0.06831 | fixed |
| sd_(Intercept).mother_pidlink | 0.359 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8622 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5631 | 0.4121 | 1.366 | -0.2447 | 1.371 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.02195 | 0.04672 | -0.4699 | -0.1135 | 0.06962 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0009012 | 0.001668 | 0.5401 | -0.002369 | 0.004171 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001601 | 0.00001891 | -0.8466 | -0.00005307 | 0.00002105 | fixed |
| male | -0.1161 | 0.02398 | -4.841 | -0.1631 | -0.0691 | fixed |
| count_birth_order2/2 | 0.031 | 0.06149 | 0.5042 | -0.08952 | 0.1515 | fixed |
| count_birth_order1/3 | 0.03858 | 0.05405 | 0.7138 | -0.06735 | 0.1445 | fixed |
| count_birth_order2/3 | 0.04624 | 0.05861 | 0.789 | -0.06863 | 0.1611 | fixed |
| count_birth_order3/3 | -0.03029 | 0.06591 | -0.4596 | -0.1595 | 0.09889 | fixed |
| count_birth_order1/4 | -0.09284 | 0.06392 | -1.452 | -0.2181 | 0.03244 | fixed |
| count_birth_order2/4 | 0.04085 | 0.06489 | 0.6295 | -0.08633 | 0.168 | fixed |
| count_birth_order3/4 | -0.03359 | 0.07128 | -0.4712 | -0.1733 | 0.1061 | fixed |
| count_birth_order4/4 | -0.05443 | 0.0736 | -0.7396 | -0.1987 | 0.08983 | fixed |
| count_birth_order1/5 | 0.01304 | 0.07582 | 0.172 | -0.1356 | 0.1616 | fixed |
| count_birth_order2/5 | 0.04794 | 0.08135 | 0.5893 | -0.1115 | 0.2074 | fixed |
| count_birth_order3/5 | -0.003747 | 0.07911 | -0.04736 | -0.1588 | 0.1513 | fixed |
| count_birth_order4/5 | -0.05214 | 0.08197 | -0.6361 | -0.2128 | 0.1085 | fixed |
| count_birth_order5/5 | 0.01449 | 0.0822 | 0.1763 | -0.1466 | 0.1756 | fixed |
| count_birth_order1/5+ | -0.04045 | 0.07206 | -0.5613 | -0.1817 | 0.1008 | fixed |
| count_birth_order2/5+ | -0.1055 | 0.07521 | -1.403 | -0.2529 | 0.04191 | fixed |
| count_birth_order3/5+ | -0.01007 | 0.07364 | -0.1367 | -0.1544 | 0.1343 | fixed |
| count_birth_order4/5+ | -0.08782 | 0.07098 | -1.237 | -0.2269 | 0.05131 | fixed |
| count_birth_order5/5+ | -0.07425 | 0.07291 | -1.018 | -0.2171 | 0.06864 | fixed |
| count_birth_order5+/5+ | -0.09624 | 0.05377 | -1.79 | -0.2016 | 0.009152 | fixed |
| sd_(Intercept).mother_pidlink | 0.3582 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8629 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 16110 | 16184 | -8044 | 16088 | NA | NA | NA |
| 12 | 16112 | 16192 | -8044 | 16088 | 0.0005688 | 1 | 0.981 |
| 16 | 16117 | 16225 | -8043 | 16085 | 2.665 | 4 | 0.6153 |
| 26 | 16132 | 16306 | -8040 | 16080 | 5.799 | 10 | 0.8318 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.4531 | 0.4156 | 1.09 | -0.3615 | 1.268 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01023 | 0.04719 | -0.2168 | -0.1027 | 0.08226 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0004686 | 0.001685 | 0.2781 | -0.002833 | 0.003771 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001034 | 0.00001909 | -0.5417 | -0.00004776 | 0.00002708 | fixed |
| male | -0.1113 | 0.02423 | -4.593 | -0.1588 | -0.0638 | fixed |
| sibling_count3 | 0.0278 | 0.03751 | 0.7411 | -0.04572 | 0.1013 | fixed |
| sibling_count4 | -0.03086 | 0.04071 | -0.7581 | -0.1107 | 0.04893 | fixed |
| sibling_count5 | -0.05099 | 0.04803 | -1.062 | -0.1451 | 0.04315 | fixed |
| sibling_count5+ | -0.1063 | 0.04162 | -2.554 | -0.1878 | -0.0247 | fixed |
| sd_(Intercept).mother_pidlink | 0.3613 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8587 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.4481 | 0.4157 | 1.078 | -0.3667 | 1.263 | fixed |
| birth_order | 0.007437 | 0.008192 | 0.9078 | -0.008619 | 0.02349 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01071 | 0.04719 | -0.2268 | -0.1032 | 0.08179 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0004727 | 0.001685 | 0.2806 | -0.002829 | 0.003775 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001009 | 0.0000191 | -0.5283 | -0.00004751 | 0.00002734 | fixed |
| male | -0.1115 | 0.02424 | -4.601 | -0.159 | -0.064 | fixed |
| sibling_count3 | 0.02415 | 0.03773 | 0.6402 | -0.04979 | 0.09809 | fixed |
| sibling_count4 | -0.03934 | 0.04177 | -0.9419 | -0.1212 | 0.04253 | fixed |
| sibling_count5 | -0.06446 | 0.05027 | -1.282 | -0.163 | 0.03407 | fixed |
| sibling_count5+ | -0.1342 | 0.05175 | -2.593 | -0.2356 | -0.03277 | fixed |
| sd_(Intercept).mother_pidlink | 0.3613 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8587 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.4518 | 0.4165 | 1.085 | -0.3644 | 1.268 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01037 | 0.04723 | -0.2196 | -0.103 | 0.08221 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0004663 | 0.001686 | 0.2765 | -0.002839 | 0.003772 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001016 | 0.00001911 | -0.5316 | -0.00004763 | 0.0000273 | fixed |
| male | -0.1112 | 0.02425 | -4.585 | -0.1587 | -0.06365 | fixed |
| sibling_count3 | 0.02459 | 0.03852 | 0.6384 | -0.05091 | 0.1001 | fixed |
| sibling_count4 | -0.03243 | 0.04344 | -0.7466 | -0.1176 | 0.0527 | fixed |
| sibling_count5 | -0.04803 | 0.05255 | -0.9139 | -0.151 | 0.05497 | fixed |
| sibling_count5+ | -0.119 | 0.05332 | -2.231 | -0.2235 | -0.01447 | fixed |
| birth_order_nonlinear2 | 0.009103 | 0.03086 | 0.295 | -0.05137 | 0.06958 | fixed |
| birth_order_nonlinear3 | 0.01424 | 0.03819 | 0.3728 | -0.06061 | 0.08909 | fixed |
| birth_order_nonlinear4 | -0.008 | 0.04863 | -0.1645 | -0.1033 | 0.08732 | fixed |
| birth_order_nonlinear5 | -0.01714 | 0.06154 | -0.2786 | -0.1378 | 0.1035 | fixed |
| birth_order_nonlinear5+ | 0.04256 | 0.06125 | 0.6948 | -0.07749 | 0.1626 | fixed |
| sd_(Intercept).mother_pidlink | 0.3603 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8594 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.4984 | 0.4175 | 1.194 | -0.3199 | 1.317 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01432 | 0.04735 | -0.3024 | -0.1071 | 0.07848 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0006025 | 0.001691 | 0.3564 | -0.002711 | 0.003916 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001163 | 0.00001917 | -0.6066 | -0.00004919 | 0.00002594 | fixed |
| male | -0.1119 | 0.02427 | -4.613 | -0.1595 | -0.06437 | fixed |
| count_birth_order2/2 | -0.02321 | 0.05452 | -0.4258 | -0.1301 | 0.08365 | fixed |
| count_birth_order1/3 | 0.0164 | 0.0492 | 0.3334 | -0.08004 | 0.1128 | fixed |
| count_birth_order2/3 | 0.0359 | 0.05434 | 0.6607 | -0.0706 | 0.1424 | fixed |
| count_birth_order3/3 | 0.005022 | 0.05963 | 0.08422 | -0.1119 | 0.1219 | fixed |
| count_birth_order1/4 | -0.05444 | 0.06119 | -0.8898 | -0.1744 | 0.06548 | fixed |
| count_birth_order2/4 | 0.01122 | 0.06281 | 0.1786 | -0.1119 | 0.1343 | fixed |
| count_birth_order3/4 | -0.05586 | 0.06573 | -0.8499 | -0.1847 | 0.07297 | fixed |
| count_birth_order4/4 | -0.06476 | 0.06956 | -0.9311 | -0.2011 | 0.07157 | fixed |
| count_birth_order1/5 | -0.1147 | 0.08246 | -1.39 | -0.2763 | 0.04697 | fixed |
| count_birth_order2/5 | -0.0301 | 0.09102 | -0.3307 | -0.2085 | 0.1483 | fixed |
| count_birth_order3/5 | -0.04437 | 0.08684 | -0.511 | -0.2146 | 0.1258 | fixed |
| count_birth_order4/5 | -0.08581 | 0.0837 | -1.025 | -0.2499 | 0.07823 | fixed |
| count_birth_order5/5 | -0.004708 | 0.08889 | -0.05296 | -0.1789 | 0.1695 | fixed |
| count_birth_order1/5+ | -0.1188 | 0.08387 | -1.416 | -0.2831 | 0.04562 | fixed |
| count_birth_order2/5+ | -0.2097 | 0.08314 | -2.522 | -0.3727 | -0.04674 | fixed |
| count_birth_order3/5+ | -0.02078 | 0.08233 | -0.2523 | -0.1821 | 0.1406 | fixed |
| count_birth_order4/5+ | -0.1022 | 0.0805 | -1.27 | -0.26 | 0.05558 | fixed |
| count_birth_order5/5+ | -0.1908 | 0.07401 | -2.578 | -0.3359 | -0.04576 | fixed |
| count_birth_order5+/5+ | -0.08773 | 0.0558 | -1.572 | -0.1971 | 0.02165 | fixed |
| sd_(Intercept).mother_pidlink | 0.3595 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8599 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 15623 | 15696 | -7801 | 15601 | NA | NA | NA |
| 12 | 15624 | 15704 | -7800 | 15600 | 0.8254 | 1 | 0.3636 |
| 16 | 15632 | 15739 | -7800 | 15600 | 0.2888 | 4 | 0.9905 |
| 26 | 15645 | 15818 | -7796 | 15593 | 7.352 | 10 | 0.6918 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = adaptive_numbering)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3787 | 0.1518 | 2.495 | 0.08118 | 0.6763 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.0186 | 0.01457 | -1.276 | -0.04715 | 0.00996 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00058 | 0.0004296 | 1.35 | -0.000262 | 0.001422 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001002 | 0.000003964 | -2.527 | -0.00001779 | -0.000002248 | fixed |
| male | 0.09485 | 0.01571 | 6.038 | 0.06406 | 0.1256 | fixed |
| sibling_count3 | 0.032 | 0.03342 | 0.9577 | -0.03349 | 0.0975 | fixed |
| sibling_count4 | -0.01255 | 0.03463 | -0.3623 | -0.08042 | 0.05533 | fixed |
| sibling_count5 | 0.0188 | 0.03622 | 0.519 | -0.05219 | 0.08979 | fixed |
| sibling_count5+ | -0.1474 | 0.02824 | -5.219 | -0.2027 | -0.09201 | fixed |
| sd_(Intercept).mother_pidlink | 0.4629 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8391 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3788 | 0.1518 | 2.495 | 0.08125 | 0.6764 | fixed |
| birth_order | 0.0008488 | 0.003398 | 0.2498 | -0.005812 | 0.007509 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01886 | 0.01461 | -1.291 | -0.04749 | 0.009776 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00059 | 0.0004315 | 1.367 | -0.0002557 | 0.001436 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001011 | 0.000003983 | -2.539 | -0.00001792 | -0.000002306 | fixed |
| male | 0.09483 | 0.01571 | 6.036 | 0.06404 | 0.1256 | fixed |
| sibling_count3 | 0.03184 | 0.03343 | 0.9526 | -0.03367 | 0.09735 | fixed |
| sibling_count4 | -0.01309 | 0.0347 | -0.3773 | -0.08111 | 0.05492 | fixed |
| sibling_count5 | 0.0178 | 0.03644 | 0.4886 | -0.05361 | 0.08922 | fixed |
| sibling_count5+ | -0.1505 | 0.03095 | -4.863 | -0.2112 | -0.08985 | fixed |
| sd_(Intercept).mother_pidlink | 0.4631 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.839 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3755 | 0.1522 | 2.467 | 0.07721 | 0.6739 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01884 | 0.01461 | -1.289 | -0.04747 | 0.0098 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.000594 | 0.0004315 | 1.376 | -0.0002518 | 0.00144 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001017 | 0.000003984 | -2.554 | -0.00001798 | -0.000002366 | fixed |
| male | 0.0947 | 0.01571 | 6.028 | 0.06391 | 0.1255 | fixed |
| sibling_count3 | 0.03351 | 0.03383 | 0.9908 | -0.03278 | 0.09981 | fixed |
| sibling_count4 | -0.006042 | 0.03553 | -0.1701 | -0.07568 | 0.06359 | fixed |
| sibling_count5 | 0.01888 | 0.03763 | 0.5017 | -0.05487 | 0.09263 | fixed |
| sibling_count5+ | -0.1519 | 0.03232 | -4.701 | -0.2153 | -0.0886 | fixed |
| birth_order_nonlinear2 | 0.006312 | 0.02259 | 0.2794 | -0.03796 | 0.05059 | fixed |
| birth_order_nonlinear3 | -0.004016 | 0.02658 | -0.1511 | -0.05611 | 0.04808 | fixed |
| birth_order_nonlinear4 | -0.02674 | 0.03029 | -0.8829 | -0.08611 | 0.03263 | fixed |
| birth_order_nonlinear5 | 0.04054 | 0.03445 | 1.177 | -0.02699 | 0.1081 | fixed |
| birth_order_nonlinear5+ | 0.0124 | 0.02911 | 0.4258 | -0.04467 | 0.06946 | fixed |
| sd_(Intercept).mother_pidlink | 0.4633 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.839 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3813 | 0.1528 | 2.495 | 0.08174 | 0.6808 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01851 | 0.01461 | -1.267 | -0.04714 | 0.01013 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0005781 | 0.0004316 | 1.339 | -0.0002678 | 0.001424 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000009971 | 0.000003985 | -2.502 | -0.00001778 | -0.00000216 | fixed |
| male | 0.09384 | 0.01571 | 5.974 | 0.06305 | 0.1246 | fixed |
| count_birth_order2/2 | -0.01282 | 0.04393 | -0.2919 | -0.09893 | 0.07329 | fixed |
| count_birth_order1/3 | -0.01112 | 0.04301 | -0.2585 | -0.09541 | 0.07317 | fixed |
| count_birth_order2/3 | 0.06464 | 0.04793 | 1.349 | -0.0293 | 0.1586 | fixed |
| count_birth_order3/3 | 0.0586 | 0.05349 | 1.095 | -0.04624 | 0.1634 | fixed |
| count_birth_order1/4 | -0.04414 | 0.04894 | -0.9019 | -0.1401 | 0.05178 | fixed |
| count_birth_order2/4 | -0.00802 | 0.05143 | -0.156 | -0.1088 | 0.09277 | fixed |
| count_birth_order3/4 | 0.01828 | 0.05567 | 0.3283 | -0.09083 | 0.1274 | fixed |
| count_birth_order4/4 | -0.02113 | 0.05884 | -0.3592 | -0.1364 | 0.09418 | fixed |
| count_birth_order1/5 | -0.0386 | 0.05535 | -0.6975 | -0.1471 | 0.06987 | fixed |
| count_birth_order2/5 | 0.0696 | 0.05811 | 1.198 | -0.04429 | 0.1835 | fixed |
| count_birth_order3/5 | -0.01428 | 0.05957 | -0.2397 | -0.131 | 0.1025 | fixed |
| count_birth_order4/5 | 0.002029 | 0.06299 | 0.03221 | -0.1214 | 0.1255 | fixed |
| count_birth_order5/5 | 0.07302 | 0.06434 | 1.135 | -0.05308 | 0.1991 | fixed |
| count_birth_order1/5+ | -0.0773 | 0.04455 | -1.735 | -0.1646 | 0.01003 | fixed |
| count_birth_order2/5+ | -0.1907 | 0.04587 | -4.157 | -0.2806 | -0.1008 | fixed |
| count_birth_order3/5+ | -0.1895 | 0.04493 | -4.217 | -0.2775 | -0.1014 | fixed |
| count_birth_order4/5+ | -0.1979 | 0.04407 | -4.49 | -0.2843 | -0.1115 | fixed |
| count_birth_order5/5+ | -0.1246 | 0.04435 | -2.81 | -0.2116 | -0.03768 | fixed |
| count_birth_order5+/5+ | -0.1466 | 0.03553 | -4.125 | -0.2162 | -0.07693 | fixed |
| sd_(Intercept).mother_pidlink | 0.4635 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8387 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 37830 | 37913 | -18904 | 37808 | NA | NA | NA |
| 12 | 37832 | 37922 | -18904 | 37808 | 0.0613 | 1 | 0.8045 |
| 16 | 37836 | 37957 | -18902 | 37804 | 3.594 | 4 | 0.4637 |
| 26 | 37840 | 38036 | -18894 | 37788 | 15.97 | 10 | 0.1004 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5739 | 0.3823 | -1.501 | -1.323 | 0.1753 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.102 | 0.04338 | 2.351 | 0.01697 | 0.187 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003674 | 0.001548 | -2.373 | -0.006709 | -0.0006395 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004194 | 0.00001754 | 2.391 | 0.000007568 | 0.00007632 | fixed |
| male | 0.03722 | 0.02229 | 1.67 | -0.006472 | 0.08091 | fixed |
| sibling_count3 | -0.02318 | 0.03623 | -0.6397 | -0.09419 | 0.04783 | fixed |
| sibling_count4 | -0.07966 | 0.03922 | -2.031 | -0.1565 | -0.002783 | fixed |
| sibling_count5 | -0.09175 | 0.04495 | -2.041 | -0.1799 | -0.003645 | fixed |
| sibling_count5+ | -0.2292 | 0.03956 | -5.795 | -0.3067 | -0.1517 | fixed |
| sd_(Intercept).mother_pidlink | 0.4128 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7721 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.581 | 0.3823 | -1.52 | -1.33 | 0.1683 | fixed |
| birth_order | 0.009145 | 0.007438 | 1.229 | -0.005433 | 0.02372 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1014 | 0.04338 | 2.338 | 0.0164 | 0.1864 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003667 | 0.001548 | -2.368 | -0.006701 | -0.0006323 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004223 | 0.00001754 | 2.408 | 0.000007859 | 0.00007661 | fixed |
| male | 0.03681 | 0.02229 | 1.651 | -0.00688 | 0.0805 | fixed |
| sibling_count3 | -0.02771 | 0.03642 | -0.7608 | -0.09909 | 0.04367 | fixed |
| sibling_count4 | -0.09046 | 0.0402 | -2.251 | -0.1692 | -0.01168 | fixed |
| sibling_count5 | -0.1094 | 0.04718 | -2.318 | -0.2018 | -0.01688 | fixed |
| sibling_count5+ | -0.2643 | 0.04877 | -5.419 | -0.3599 | -0.1687 | fixed |
| sd_(Intercept).mother_pidlink | 0.4131 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7719 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5991 | 0.3831 | -1.564 | -1.35 | 0.1518 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.104 | 0.04342 | 2.395 | 0.0189 | 0.1891 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003757 | 0.00155 | -2.425 | -0.006795 | -0.00072 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004323 | 0.00001756 | 2.462 | 0.000008815 | 0.00007764 | fixed |
| male | 0.03724 | 0.0223 | 1.67 | -0.006459 | 0.08094 | fixed |
| sibling_count3 | -0.03169 | 0.0371 | -0.8543 | -0.1044 | 0.04102 | fixed |
| sibling_count4 | -0.09277 | 0.04163 | -2.228 | -0.1744 | -0.01117 | fixed |
| sibling_count5 | -0.1259 | 0.04936 | -2.55 | -0.2226 | -0.02913 | fixed |
| sibling_count5+ | -0.2684 | 0.05009 | -5.359 | -0.3666 | -0.1703 | fixed |
| birth_order_nonlinear2 | 0.02271 | 0.02845 | 0.7982 | -0.03305 | 0.07847 | fixed |
| birth_order_nonlinear3 | 0.0366 | 0.03519 | 1.04 | -0.03238 | 0.1056 | fixed |
| birth_order_nonlinear4 | 0.02322 | 0.04359 | 0.5326 | -0.06222 | 0.1087 | fixed |
| birth_order_nonlinear5 | 0.1172 | 0.05437 | 2.156 | 0.01065 | 0.2238 | fixed |
| birth_order_nonlinear5+ | 0.04245 | 0.05526 | 0.7682 | -0.06586 | 0.1508 | fixed |
| sd_(Intercept).mother_pidlink | 0.413 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.772 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5894 | 0.384 | -1.535 | -1.342 | 0.1632 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1022 | 0.04351 | 2.348 | 0.01689 | 0.1875 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003663 | 0.001553 | -2.358 | -0.006707 | -0.0006186 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004183 | 0.0000176 | 2.376 | 0.000007331 | 0.00007633 | fixed |
| male | 0.03646 | 0.02231 | 1.634 | -0.007272 | 0.08019 | fixed |
| count_birth_order2/2 | 0.02404 | 0.05166 | 0.4654 | -0.07721 | 0.1253 | fixed |
| count_birth_order1/3 | -0.05451 | 0.04671 | -1.167 | -0.1461 | 0.03704 | fixed |
| count_birth_order2/3 | 0.01584 | 0.05088 | 0.3112 | -0.0839 | 0.1156 | fixed |
| count_birth_order3/3 | 0.01729 | 0.05675 | 0.3047 | -0.09393 | 0.1285 | fixed |
| count_birth_order1/4 | -0.1283 | 0.05698 | -2.251 | -0.2399 | -0.0166 | fixed |
| count_birth_order2/4 | -0.06935 | 0.05883 | -1.179 | -0.1847 | 0.04596 | fixed |
| count_birth_order3/4 | -0.03725 | 0.06203 | -0.6005 | -0.1588 | 0.08433 | fixed |
| count_birth_order4/4 | -0.03674 | 0.06447 | -0.5699 | -0.1631 | 0.08962 | fixed |
| count_birth_order1/5 | -0.03692 | 0.07709 | -0.4789 | -0.188 | 0.1142 | fixed |
| count_birth_order2/5 | -0.1199 | 0.0823 | -1.457 | -0.2812 | 0.04141 | fixed |
| count_birth_order3/5 | -0.154 | 0.07716 | -1.996 | -0.3052 | -0.002782 | fixed |
| count_birth_order4/5 | -0.1267 | 0.0744 | -1.704 | -0.2726 | 0.01907 | fixed |
| count_birth_order5/5 | 0.002534 | 0.07733 | 0.03277 | -0.149 | 0.1541 | fixed |
| count_birth_order1/5+ | -0.1809 | 0.07635 | -2.37 | -0.3306 | -0.03129 | fixed |
| count_birth_order2/5+ | -0.3047 | 0.07551 | -4.035 | -0.4527 | -0.1567 | fixed |
| count_birth_order3/5+ | -0.2237 | 0.07552 | -2.963 | -0.3718 | -0.07573 | fixed |
| count_birth_order4/5+ | -0.2646 | 0.07115 | -3.718 | -0.404 | -0.1251 | fixed |
| count_birth_order5/5+ | -0.1598 | 0.06737 | -2.372 | -0.2919 | -0.02778 | fixed |
| count_birth_order5+/5+ | -0.2265 | 0.05166 | -4.384 | -0.3277 | -0.1252 | fixed |
| sd_(Intercept).mother_pidlink | 0.413 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7722 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 15107 | 15181 | -7543 | 15085 | NA | NA | NA |
| 12 | 15108 | 15188 | -7542 | 15084 | 1.512 | 1 | 0.2188 |
| 16 | 15112 | 15219 | -7540 | 15080 | 3.495 | 4 | 0.4787 |
| 26 | 15124 | 15298 | -7536 | 15072 | 7.814 | 10 | 0.647 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.547 | 0.381 | -1.436 | -1.294 | 0.1998 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09819 | 0.04326 | 2.27 | 0.01341 | 0.183 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003581 | 0.001544 | -2.319 | -0.006608 | -0.0005544 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000409 | 0.0000175 | 2.338 | 0.00000661 | 0.00007519 | fixed |
| male | 0.03865 | 0.0222 | 1.741 | -0.004853 | 0.08215 | fixed |
| sibling_count3 | -0.001308 | 0.03913 | -0.03344 | -0.078 | 0.07538 | fixed |
| sibling_count4 | -0.05356 | 0.04142 | -1.293 | -0.1347 | 0.02763 | fixed |
| sibling_count5 | -0.04134 | 0.04448 | -0.9294 | -0.1285 | 0.04584 | fixed |
| sibling_count5+ | -0.1437 | 0.03893 | -3.692 | -0.22 | -0.06743 | fixed |
| sd_(Intercept).mother_pidlink | 0.4147 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7712 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.548 | 0.3811 | -1.438 | -1.295 | 0.1989 | fixed |
| birth_order | 0.0009386 | 0.006519 | 0.144 | -0.01184 | 0.01372 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09817 | 0.04326 | 2.269 | 0.01338 | 0.183 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003582 | 0.001544 | -2.319 | -0.006608 | -0.0005547 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004095 | 0.0000175 | 2.34 | 0.000006647 | 0.00007524 | fixed |
| male | 0.03861 | 0.0222 | 1.739 | -0.004894 | 0.08212 | fixed |
| sibling_count3 | -0.001773 | 0.03926 | -0.04515 | -0.07873 | 0.07518 | fixed |
| sibling_count4 | -0.05462 | 0.04208 | -1.298 | -0.1371 | 0.02785 | fixed |
| sibling_count5 | -0.04301 | 0.04597 | -0.9356 | -0.1331 | 0.04709 | fixed |
| sibling_count5+ | -0.1472 | 0.04585 | -3.211 | -0.2371 | -0.05736 | fixed |
| sd_(Intercept).mother_pidlink | 0.4149 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7712 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5634 | 0.3817 | -1.476 | -1.311 | 0.1846 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09955 | 0.04328 | 2.3 | 0.01473 | 0.1844 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003632 | 0.001545 | -2.35 | -0.00666 | -0.0006033 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004154 | 0.00001751 | 2.373 | 0.000007224 | 0.00007586 | fixed |
| male | 0.03953 | 0.0222 | 1.781 | -0.003975 | 0.08303 | fixed |
| sibling_count3 | 0.0002314 | 0.03989 | 0.005801 | -0.07796 | 0.07842 | fixed |
| sibling_count4 | -0.04784 | 0.04341 | -1.102 | -0.1329 | 0.03725 | fixed |
| sibling_count5 | -0.05674 | 0.04795 | -1.183 | -0.1507 | 0.03724 | fixed |
| sibling_count5+ | -0.1505 | 0.04712 | -3.194 | -0.2429 | -0.05815 | fixed |
| birth_order_nonlinear2 | 0.01206 | 0.02899 | 0.416 | -0.04476 | 0.06888 | fixed |
| birth_order_nonlinear3 | -0.007123 | 0.03509 | -0.203 | -0.0759 | 0.06165 | fixed |
| birth_order_nonlinear4 | -0.02017 | 0.04232 | -0.4766 | -0.1031 | 0.06278 | fixed |
| birth_order_nonlinear5 | 0.119 | 0.05185 | 2.294 | 0.01734 | 0.2206 | fixed |
| birth_order_nonlinear5+ | -0.007059 | 0.04951 | -0.1426 | -0.1041 | 0.08997 | fixed |
| sd_(Intercept).mother_pidlink | 0.4146 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.771 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5329 | 0.3822 | -1.394 | -1.282 | 0.2162 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09492 | 0.04332 | 2.191 | 0.01003 | 0.1798 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00344 | 0.001547 | -2.224 | -0.006472 | -0.0004087 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003911 | 0.00001753 | 2.231 | 0.000004748 | 0.00007347 | fixed |
| male | 0.03859 | 0.0222 | 1.739 | -0.004913 | 0.0821 | fixed |
| count_birth_order2/2 | 0.02549 | 0.05653 | 0.4508 | -0.08532 | 0.1363 | fixed |
| count_birth_order1/3 | -0.01494 | 0.05051 | -0.2957 | -0.1139 | 0.08406 | fixed |
| count_birth_order2/3 | 0.0181 | 0.05465 | 0.3312 | -0.08901 | 0.1252 | fixed |
| count_birth_order3/3 | 0.03519 | 0.06135 | 0.5737 | -0.08505 | 0.1554 | fixed |
| count_birth_order1/4 | -0.1124 | 0.05962 | -1.886 | -0.2293 | 0.004432 | fixed |
| count_birth_order2/4 | 0.02033 | 0.06071 | 0.3348 | -0.09866 | 0.1393 | fixed |
| count_birth_order3/4 | -0.01424 | 0.06636 | -0.2146 | -0.1443 | 0.1158 | fixed |
| count_birth_order4/4 | -0.06868 | 0.06842 | -1.004 | -0.2028 | 0.06542 | fixed |
| count_birth_order1/5 | 0.01101 | 0.07059 | 0.1559 | -0.1274 | 0.1494 | fixed |
| count_birth_order2/5 | -0.05006 | 0.07557 | -0.6624 | -0.1982 | 0.09805 | fixed |
| count_birth_order3/5 | -0.1674 | 0.07348 | -2.278 | -0.3114 | -0.02335 | fixed |
| count_birth_order4/5 | -0.07244 | 0.07609 | -0.952 | -0.2216 | 0.07669 | fixed |
| count_birth_order5/5 | 0.1097 | 0.0763 | 1.438 | -0.03981 | 0.2593 | fixed |
| count_birth_order1/5+ | -0.0476 | 0.06705 | -0.7099 | -0.179 | 0.08382 | fixed |
| count_birth_order2/5+ | -0.2193 | 0.06985 | -3.139 | -0.3561 | -0.08236 | fixed |
| count_birth_order3/5+ | -0.1526 | 0.06844 | -2.229 | -0.2867 | -0.01843 | fixed |
| count_birth_order4/5+ | -0.1628 | 0.06588 | -2.471 | -0.2919 | -0.03363 | fixed |
| count_birth_order5/5+ | -0.06021 | 0.06758 | -0.891 | -0.1927 | 0.07224 | fixed |
| count_birth_order5+/5+ | -0.1548 | 0.05053 | -3.063 | -0.2538 | -0.05575 | fixed |
| sd_(Intercept).mother_pidlink | 0.4146 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7706 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 15237 | 15311 | -7608 | 15215 | NA | NA | NA |
| 12 | 15239 | 15319 | -7608 | 15215 | 0.02042 | 1 | 0.8864 |
| 16 | 15239 | 15346 | -7604 | 15207 | 7.892 | 4 | 0.09562 |
| 26 | 15244 | 15418 | -7596 | 15192 | 15.53 | 10 | 0.1138 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.6109 | 0.3868 | -1.579 | -1.369 | 0.1473 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1055 | 0.04391 | 2.404 | 0.01948 | 0.1916 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003789 | 0.001568 | -2.417 | -0.006861 | -0.0007159 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004303 | 0.00001777 | 2.422 | 0.000008203 | 0.00007785 | fixed |
| male | 0.03418 | 0.02252 | 1.518 | -0.009957 | 0.07831 | fixed |
| sibling_count3 | -0.01054 | 0.03585 | -0.294 | -0.08081 | 0.05973 | fixed |
| sibling_count4 | -0.08272 | 0.03907 | -2.117 | -0.1593 | -0.006154 | fixed |
| sibling_count5 | -0.07539 | 0.04627 | -1.629 | -0.1661 | 0.01529 | fixed |
| sibling_count5+ | -0.2279 | 0.04017 | -5.672 | -0.3066 | -0.1491 | fixed |
| sd_(Intercept).mother_pidlink | 0.4197 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7695 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.6191 | 0.3868 | -1.601 | -1.377 | 0.1389 | fixed |
| birth_order | 0.0126 | 0.007659 | 1.645 | -0.002409 | 0.02762 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1046 | 0.04391 | 2.383 | 0.01855 | 0.1907 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003775 | 0.001567 | -2.408 | -0.006847 | -0.0007029 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000434 | 0.00001777 | 2.443 | 0.00000858 | 0.00007822 | fixed |
| male | 0.03386 | 0.02252 | 1.504 | -0.01027 | 0.07799 | fixed |
| sibling_count3 | -0.01685 | 0.03605 | -0.4673 | -0.08751 | 0.05382 | fixed |
| sibling_count4 | -0.0974 | 0.04007 | -2.431 | -0.1759 | -0.01887 | fixed |
| sibling_count5 | -0.09864 | 0.04838 | -2.039 | -0.1935 | -0.003825 | fixed |
| sibling_count5+ | -0.2758 | 0.04961 | -5.559 | -0.373 | -0.1785 | fixed |
| sd_(Intercept).mother_pidlink | 0.42 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7693 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.638 | 0.3876 | -1.646 | -1.398 | 0.1216 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1074 | 0.04395 | 2.444 | 0.02129 | 0.1936 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003874 | 0.001569 | -2.469 | -0.006949 | -0.0007993 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004448 | 0.00001778 | 2.501 | 0.000009626 | 0.00007934 | fixed |
| male | 0.03404 | 0.02252 | 1.511 | -0.0101 | 0.07818 | fixed |
| sibling_count3 | -0.0171 | 0.03674 | -0.4653 | -0.08911 | 0.05492 | fixed |
| sibling_count4 | -0.09868 | 0.04153 | -2.376 | -0.1801 | -0.01729 | fixed |
| sibling_count5 | -0.1131 | 0.05037 | -2.245 | -0.2118 | -0.01436 | fixed |
| sibling_count5+ | -0.2769 | 0.05098 | -5.432 | -0.3768 | -0.177 | fixed |
| birth_order_nonlinear2 | 0.03343 | 0.02836 | 1.179 | -0.02215 | 0.08901 | fixed |
| birth_order_nonlinear3 | 0.02907 | 0.03517 | 0.8265 | -0.03986 | 0.09799 | fixed |
| birth_order_nonlinear4 | 0.04795 | 0.04482 | 1.07 | -0.03988 | 0.1358 | fixed |
| birth_order_nonlinear5 | 0.1317 | 0.05668 | 2.324 | 0.02065 | 0.2428 | fixed |
| birth_order_nonlinear5+ | 0.06088 | 0.05697 | 1.069 | -0.05078 | 0.1725 | fixed |
| sd_(Intercept).mother_pidlink | 0.4191 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7697 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.6225 | 0.3884 | -1.602 | -1.384 | 0.1389 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1047 | 0.04404 | 2.378 | 0.01842 | 0.1911 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003746 | 0.001573 | -2.382 | -0.006828 | -0.0006634 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004268 | 0.00001783 | 2.394 | 0.000007732 | 0.00007762 | fixed |
| male | 0.03277 | 0.02253 | 1.454 | -0.0114 | 0.07693 | fixed |
| count_birth_order2/2 | 0.0373 | 0.05023 | 0.7426 | -0.06115 | 0.1358 | fixed |
| count_birth_order1/3 | -0.0397 | 0.04617 | -0.86 | -0.1302 | 0.05078 | fixed |
| count_birth_order2/3 | 0.04364 | 0.05085 | 0.8583 | -0.05602 | 0.1433 | fixed |
| count_birth_order3/3 | 0.02499 | 0.05573 | 0.4484 | -0.08424 | 0.1342 | fixed |
| count_birth_order1/4 | -0.1454 | 0.05724 | -2.54 | -0.2576 | -0.03319 | fixed |
| count_birth_order2/4 | -0.06066 | 0.05873 | -1.033 | -0.1758 | 0.05444 | fixed |
| count_birth_order3/4 | -0.04567 | 0.06138 | -0.744 | -0.166 | 0.07463 | fixed |
| count_birth_order4/4 | -0.009882 | 0.06483 | -0.1524 | -0.1369 | 0.1172 | fixed |
| count_birth_order1/5 | -0.03364 | 0.07699 | -0.4369 | -0.1845 | 0.1173 | fixed |
| count_birth_order2/5 | -0.1226 | 0.08473 | -1.447 | -0.2887 | 0.04345 | fixed |
| count_birth_order3/5 | -0.1298 | 0.08084 | -1.606 | -0.2883 | 0.02861 | fixed |
| count_birth_order4/5 | -0.08387 | 0.07798 | -1.075 | -0.2367 | 0.06897 | fixed |
| count_birth_order5/5 | 0.0319 | 0.08276 | 0.3854 | -0.1303 | 0.1941 | fixed |
| count_birth_order1/5+ | -0.1417 | 0.07812 | -1.814 | -0.2948 | 0.01137 | fixed |
| count_birth_order2/5+ | -0.3013 | 0.07739 | -3.893 | -0.4529 | -0.1496 | fixed |
| count_birth_order3/5+ | -0.2695 | 0.07655 | -3.521 | -0.4196 | -0.1195 | fixed |
| count_birth_order4/5+ | -0.2658 | 0.07478 | -3.554 | -0.4123 | -0.1192 | fixed |
| count_birth_order5/5+ | -0.1536 | 0.06895 | -2.227 | -0.2887 | -0.01844 | fixed |
| count_birth_order5+/5+ | -0.2161 | 0.05268 | -4.102 | -0.3193 | -0.1128 | fixed |
| sd_(Intercept).mother_pidlink | 0.4191 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.7697 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 14808 | 14882 | -7393 | 14786 | NA | NA | NA |
| 12 | 14808 | 14888 | -7392 | 14784 | 2.71 | 1 | 0.09974 |
| 16 | 14813 | 14919 | -7390 | 14781 | 3.147 | 4 | 0.5336 |
| 26 | 14822 | 14995 | -7385 | 14770 | 10.48 | 10 | 0.3993 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = big5_ext)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5858 | 0.1594 | 3.676 | 0.2735 | 0.8982 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.0431 | 0.01526 | -2.824 | -0.07301 | -0.01319 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001286 | 0.0004482 | 2.868 | 0.0004071 | 0.002164 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001265 | 0.000004122 | -3.068 | -0.00002073 | -0.000004568 | fixed |
| male | -0.2258 | 0.01689 | -13.37 | -0.2589 | -0.1927 | fixed |
| sibling_count3 | 0.009322 | 0.03332 | 0.2798 | -0.05598 | 0.07462 | fixed |
| sibling_count4 | -0.02026 | 0.03419 | -0.5925 | -0.08728 | 0.04676 | fixed |
| sibling_count5 | -0.02693 | 0.03538 | -0.7611 | -0.09627 | 0.04241 | fixed |
| sibling_count5+ | -0.01081 | 0.02791 | -0.3874 | -0.06552 | 0.0439 | fixed |
| sd_(Intercept).mother_pidlink | 0.2287 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9711 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5841 | 0.1594 | 3.665 | 0.2718 | 0.8965 | fixed |
| birth_order | -0.003173 | 0.003493 | -0.9085 | -0.01002 | 0.003673 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04216 | 0.01529 | -2.757 | -0.07214 | -0.01219 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001253 | 0.0004497 | 2.786 | 0.0003715 | 0.002134 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001235 | 0.000004135 | -2.987 | -0.00002045 | -0.000004247 | fixed |
| male | -0.2257 | 0.01689 | -13.36 | -0.2588 | -0.1926 | fixed |
| sibling_count3 | 0.01013 | 0.03333 | 0.304 | -0.05519 | 0.07545 | fixed |
| sibling_count4 | -0.01798 | 0.03428 | -0.5243 | -0.08517 | 0.04922 | fixed |
| sibling_count5 | -0.02301 | 0.03564 | -0.6457 | -0.09286 | 0.04684 | fixed |
| sibling_count5+ | 0.001366 | 0.03097 | 0.0441 | -0.05933 | 0.06206 | fixed |
| sd_(Intercept).mother_pidlink | 0.2281 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9712 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5626 | 0.1598 | 3.521 | 0.2494 | 0.8758 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04263 | 0.0153 | -2.787 | -0.07262 | -0.01265 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001264 | 0.0004498 | 2.809 | 0.000382 | 0.002145 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001237 | 0.000004136 | -2.991 | -0.00002048 | -0.000004262 | fixed |
| male | -0.2257 | 0.01689 | -13.36 | -0.2588 | -0.1926 | fixed |
| sibling_count3 | 0.01351 | 0.03385 | 0.3991 | -0.05284 | 0.07985 | fixed |
| sibling_count4 | -0.01763 | 0.03537 | -0.4984 | -0.08695 | 0.05169 | fixed |
| sibling_count5 | -0.02496 | 0.03719 | -0.6712 | -0.09785 | 0.04793 | fixed |
| sibling_count5+ | -0.005669 | 0.03271 | -0.1733 | -0.06978 | 0.05845 | fixed |
| birth_order_nonlinear2 | 0.05536 | 0.02472 | 2.239 | 0.006905 | 0.1038 | fixed |
| birth_order_nonlinear3 | -0.003555 | 0.02919 | -0.1218 | -0.06076 | 0.05365 | fixed |
| birth_order_nonlinear4 | 0.02086 | 0.03323 | 0.6278 | -0.04427 | 0.086 | fixed |
| birth_order_nonlinear5 | 0.02606 | 0.03779 | 0.6897 | -0.048 | 0.1001 | fixed |
| birth_order_nonlinear5+ | 0.01193 | 0.031 | 0.3846 | -0.04884 | 0.07269 | fixed |
| sd_(Intercept).mother_pidlink | 0.229 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9709 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5658 | 0.1605 | 3.525 | 0.2511 | 0.8804 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04235 | 0.0153 | -2.767 | -0.07234 | -0.01235 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001259 | 0.0004499 | 2.799 | 0.0003773 | 0.002141 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001236 | 0.000004137 | -2.987 | -0.00002047 | -0.00000425 | fixed |
| male | -0.2255 | 0.0169 | -13.35 | -0.2587 | -0.1924 | fixed |
| count_birth_order2/2 | 0.03555 | 0.04808 | 0.7393 | -0.05869 | 0.1298 | fixed |
| count_birth_order1/3 | 0.006548 | 0.04502 | 0.1454 | -0.08169 | 0.09478 | fixed |
| count_birth_order2/3 | 0.0579 | 0.05035 | 1.15 | -0.04078 | 0.1566 | fixed |
| count_birth_order3/3 | 0.006575 | 0.05641 | 0.1166 | -0.104 | 0.1171 | fixed |
| count_birth_order1/4 | -0.03226 | 0.05142 | -0.6274 | -0.133 | 0.06852 | fixed |
| count_birth_order2/4 | 0.09717 | 0.05408 | 1.797 | -0.008825 | 0.2032 | fixed |
| count_birth_order3/4 | -0.06283 | 0.05877 | -1.069 | -0.178 | 0.05235 | fixed |
| count_birth_order4/4 | -0.0513 | 0.06223 | -0.8244 | -0.1733 | 0.07066 | fixed |
| count_birth_order1/5 | -0.04349 | 0.05836 | -0.7453 | -0.1579 | 0.07088 | fixed |
| count_birth_order2/5 | -0.01869 | 0.06139 | -0.3045 | -0.139 | 0.1016 | fixed |
| count_birth_order3/5 | -0.0007656 | 0.06302 | -0.01215 | -0.1243 | 0.1227 | fixed |
| count_birth_order4/5 | 0.04999 | 0.06676 | 0.7488 | -0.08086 | 0.1808 | fixed |
| count_birth_order5/5 | -0.04369 | 0.06825 | -0.6402 | -0.1775 | 0.09008 | fixed |
| count_birth_order1/5+ | -0.01372 | 0.04714 | -0.2911 | -0.1061 | 0.07867 | fixed |
| count_birth_order2/5+ | 0.03022 | 0.04863 | 0.6215 | -0.06509 | 0.1255 | fixed |
| count_birth_order3/5+ | -0.01704 | 0.04765 | -0.3577 | -0.1104 | 0.07634 | fixed |
| count_birth_order4/5+ | 0.005439 | 0.04669 | 0.1165 | -0.08607 | 0.09695 | fixed |
| count_birth_order5/5+ | 0.02545 | 0.04704 | 0.5409 | -0.06675 | 0.1176 | fixed |
| count_birth_order5+/5+ | -0.001348 | 0.03641 | -0.03702 | -0.07272 | 0.07002 | fixed |
| sd_(Intercept).mother_pidlink | 0.2285 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9712 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 39460 | 39543 | -19719 | 39438 | NA | NA | NA |
| 12 | 39461 | 39552 | -19719 | 39437 | 0.8272 | 1 | 0.3631 |
| 16 | 39464 | 39585 | -19716 | 39432 | 5.522 | 4 | 0.2378 |
| 26 | 39477 | 39673 | -19713 | 39425 | 6.545 | 10 | 0.7676 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.152 | 0.4495 | 2.564 | 0.2714 | 2.033 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1016 | 0.05098 | -1.992 | -0.2015 | -0.001649 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003476 | 0.001819 | 1.912 | -0.00008788 | 0.007041 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00003723 | 0.00002058 | -1.809 | -0.00007757 | 0.00000311 | fixed |
| male | -0.2631 | 0.02631 | -10 | -0.3147 | -0.2115 | fixed |
| sibling_count3 | -0.03372 | 0.04026 | -0.8374 | -0.1126 | 0.0452 | fixed |
| sibling_count4 | -0.08771 | 0.04309 | -2.036 | -0.1722 | -0.003257 | fixed |
| sibling_count5 | -0.08529 | 0.04889 | -1.744 | -0.1811 | 0.01054 | fixed |
| sibling_count5+ | -0.09583 | 0.04277 | -2.241 | -0.1797 | -0.012 | fixed |
| sd_(Intercept).mother_pidlink | 0.1894 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9934 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.141 | 0.4495 | 2.539 | 0.2601 | 2.022 | fixed |
| birth_order | 0.01356 | 0.008594 | 1.578 | -0.003286 | 0.0304 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1021 | 0.05098 | -2.003 | -0.202 | -0.002184 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003471 | 0.001818 | 1.909 | -0.00009333 | 0.007034 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00003665 | 0.00002058 | -1.78 | -0.00007699 | 0.000003697 | fixed |
| male | -0.2636 | 0.02631 | -10.02 | -0.3152 | -0.2121 | fixed |
| sibling_count3 | -0.04022 | 0.04048 | -0.9935 | -0.1196 | 0.03912 | fixed |
| sibling_count4 | -0.103 | 0.04417 | -2.331 | -0.1895 | -0.01639 | fixed |
| sibling_count5 | -0.1104 | 0.05143 | -2.146 | -0.2112 | -0.009566 | fixed |
| sibling_count5+ | -0.1462 | 0.05344 | -2.736 | -0.251 | -0.04149 | fixed |
| sd_(Intercept).mother_pidlink | 0.1924 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9927 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.11 | 0.4497 | 2.467 | 0.228 | 1.991 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.09789 | 0.05096 | -1.921 | -0.1978 | 0.001998 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003318 | 0.001818 | 1.825 | -0.0002447 | 0.006882 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00003493 | 0.00002058 | -1.697 | -0.00007527 | 0.000005413 | fixed |
| male | -0.2635 | 0.02629 | -10.02 | -0.315 | -0.2119 | fixed |
| sibling_count3 | -0.04151 | 0.04136 | -1.004 | -0.1226 | 0.03955 | fixed |
| sibling_count4 | -0.1168 | 0.04604 | -2.538 | -0.2071 | -0.0266 | fixed |
| sibling_count5 | -0.1589 | 0.0543 | -2.927 | -0.2653 | -0.05248 | fixed |
| sibling_count5+ | -0.1572 | 0.05516 | -2.85 | -0.2653 | -0.04908 | fixed |
| birth_order_nonlinear2 | 0.03992 | 0.03448 | 1.158 | -0.02766 | 0.1075 | fixed |
| birth_order_nonlinear3 | 0.03437 | 0.04242 | 0.8102 | -0.04877 | 0.1175 | fixed |
| birth_order_nonlinear4 | 0.1099 | 0.05233 | 2.101 | 0.007368 | 0.2125 | fixed |
| birth_order_nonlinear5 | 0.2364 | 0.06542 | 3.614 | 0.1082 | 0.3647 | fixed |
| birth_order_nonlinear5+ | 0.03262 | 0.06472 | 0.504 | -0.09422 | 0.1595 | fixed |
| sd_(Intercept).mother_pidlink | 0.1872 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9929 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.085 | 0.4508 | 2.407 | 0.2013 | 1.968 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.09453 | 0.05108 | -1.851 | -0.1946 | 0.005591 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003205 | 0.001822 | 1.758 | -0.0003673 | 0.006776 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00003372 | 0.00002064 | -1.634 | -0.00007416 | 0.000006732 | fixed |
| male | -0.2623 | 0.02632 | -9.964 | -0.3138 | -0.2107 | fixed |
| count_birth_order2/2 | 0.02096 | 0.06225 | 0.3367 | -0.1011 | 0.143 | fixed |
| count_birth_order1/3 | -0.08328 | 0.05417 | -1.537 | -0.1895 | 0.02289 | fixed |
| count_birth_order2/3 | 0.03793 | 0.05923 | 0.6403 | -0.07817 | 0.154 | fixed |
| count_birth_order3/3 | -0.01001 | 0.06626 | -0.151 | -0.1399 | 0.1199 | fixed |
| count_birth_order1/4 | -0.06131 | 0.06625 | -0.9255 | -0.1912 | 0.06854 | fixed |
| count_birth_order2/4 | -0.1186 | 0.06863 | -1.728 | -0.2531 | 0.01589 | fixed |
| count_birth_order3/4 | -0.1046 | 0.07259 | -1.442 | -0.2469 | 0.03763 | fixed |
| count_birth_order4/4 | -0.04082 | 0.07548 | -0.5408 | -0.1887 | 0.1071 | fixed |
| count_birth_order1/5 | -0.1233 | 0.09008 | -1.368 | -0.2998 | 0.05329 | fixed |
| count_birth_order2/5 | -0.163 | 0.09652 | -1.689 | -0.3522 | 0.02615 | fixed |
| count_birth_order3/5 | -0.1296 | 0.0905 | -1.432 | -0.307 | 0.04775 | fixed |
| count_birth_order4/5 | -0.05215 | 0.08716 | -0.5983 | -0.223 | 0.1187 | fixed |
| count_birth_order5/5 | 0.05478 | 0.09073 | 0.6037 | -0.1231 | 0.2326 | fixed |
| count_birth_order1/5+ | -0.2236 | 0.08934 | -2.503 | -0.3987 | -0.04849 | fixed |
| count_birth_order2/5+ | -0.1293 | 0.0885 | -1.461 | -0.3028 | 0.04414 | fixed |
| count_birth_order3/5+ | -0.1131 | 0.08873 | -1.275 | -0.287 | 0.06082 | fixed |
| count_birth_order4/5+ | -0.0233 | 0.08363 | -0.2786 | -0.1872 | 0.1406 | fixed |
| count_birth_order5/5+ | 0.08399 | 0.07903 | 1.063 | -0.07091 | 0.2389 | fixed |
| count_birth_order5+/5+ | -0.1312 | 0.05874 | -2.234 | -0.2463 | -0.01608 | fixed |
| sd_(Intercept).mother_pidlink | 0.1883 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9931 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 16954 | 17028 | -8466 | 16932 | NA | NA | NA |
| 12 | 16954 | 17034 | -8465 | 16930 | 2.483 | 1 | 0.1151 |
| 16 | 16948 | 17055 | -8458 | 16916 | 13.26 | 4 | 0.01007 |
| 26 | 16963 | 17137 | -8456 | 16911 | 5.148 | 10 | 0.8811 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.163 | 0.4489 | 2.591 | 0.2832 | 2.043 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1022 | 0.05094 | -2.007 | -0.2021 | -0.002389 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003524 | 0.001817 | 1.939 | -0.00003806 | 0.007086 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00003799 | 0.00002057 | -1.847 | -0.00007832 | 0.000002332 | fixed |
| male | -0.2654 | 0.02625 | -10.11 | -0.3169 | -0.214 | fixed |
| sibling_count3 | -0.03632 | 0.04368 | -0.8315 | -0.1219 | 0.04929 | fixed |
| sibling_count4 | -0.07942 | 0.04582 | -1.733 | -0.1692 | 0.01039 | fixed |
| sibling_count5 | -0.1033 | 0.04875 | -2.119 | -0.1988 | -0.007751 | fixed |
| sibling_count5+ | -0.1059 | 0.04277 | -2.477 | -0.1898 | -0.02212 | fixed |
| sd_(Intercept).mother_pidlink | 0.1912 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9951 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.15 | 0.4489 | 2.561 | 0.2698 | 2.029 | fixed |
| birth_order | 0.01209 | 0.007482 | 1.616 | -0.002573 | 0.02676 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1023 | 0.05093 | -2.009 | -0.2021 | -0.002473 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003505 | 0.001817 | 1.929 | -0.00005715 | 0.007066 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00003732 | 0.00002058 | -1.813 | -0.00007765 | 0.000003014 | fixed |
| male | -0.2658 | 0.02625 | -10.13 | -0.3173 | -0.2144 | fixed |
| sibling_count3 | -0.04207 | 0.04384 | -0.9598 | -0.128 | 0.04385 | fixed |
| sibling_count4 | -0.0925 | 0.04655 | -1.987 | -0.1837 | -0.001275 | fixed |
| sibling_count5 | -0.1239 | 0.05041 | -2.458 | -0.2227 | -0.0251 | fixed |
| sibling_count5+ | -0.1499 | 0.05073 | -2.954 | -0.2493 | -0.05044 | fixed |
| sd_(Intercept).mother_pidlink | 0.1956 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9941 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.141 | 0.4493 | 2.539 | 0.26 | 2.021 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1002 | 0.05094 | -1.968 | -0.2001 | -0.0003941 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003429 | 0.001818 | 1.887 | -0.0001333 | 0.006992 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00003645 | 0.00002059 | -1.771 | -0.00007679 | 0.0000039 | fixed |
| male | -0.2649 | 0.02625 | -10.09 | -0.3164 | -0.2135 | fixed |
| sibling_count3 | -0.04594 | 0.0447 | -1.028 | -0.1335 | 0.04167 | fixed |
| sibling_count4 | -0.09413 | 0.04833 | -1.948 | -0.1889 | 0.0005931 | fixed |
| sibling_count5 | -0.1497 | 0.05306 | -2.821 | -0.2537 | -0.04569 | fixed |
| sibling_count5+ | -0.1589 | 0.05247 | -3.027 | -0.2617 | -0.05601 | fixed |
| birth_order_nonlinear2 | 0.02093 | 0.03515 | 0.5955 | -0.04796 | 0.08982 | fixed |
| birth_order_nonlinear3 | 0.04145 | 0.04233 | 0.9792 | -0.04151 | 0.1244 | fixed |
| birth_order_nonlinear4 | 0.02811 | 0.05083 | 0.5529 | -0.07152 | 0.1277 | fixed |
| birth_order_nonlinear5 | 0.1845 | 0.06237 | 2.959 | 0.06228 | 0.3068 | fixed |
| birth_order_nonlinear5+ | 0.06251 | 0.0578 | 1.081 | -0.05078 | 0.1758 | fixed |
| sd_(Intercept).mother_pidlink | 0.1939 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9942 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.137 | 0.4502 | 2.525 | 0.2545 | 2.019 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.09952 | 0.05102 | -1.95 | -0.1995 | 0.0004835 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003409 | 0.001821 | 1.872 | -0.0001598 | 0.006978 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00003628 | 0.00002062 | -1.759 | -0.0000767 | 0.000004144 | fixed |
| male | -0.265 | 0.02627 | -10.08 | -0.3165 | -0.2135 | fixed |
| count_birth_order2/2 | 0.01043 | 0.06822 | 0.153 | -0.1233 | 0.1441 | fixed |
| count_birth_order1/3 | -0.08321 | 0.05879 | -1.415 | -0.1984 | 0.03202 | fixed |
| count_birth_order2/3 | 0.01868 | 0.06381 | 0.2928 | -0.1064 | 0.1437 | fixed |
| count_birth_order3/3 | -0.0109 | 0.07186 | -0.1517 | -0.1517 | 0.1299 | fixed |
| count_birth_order1/4 | -0.05074 | 0.06955 | -0.7296 | -0.1871 | 0.08557 | fixed |
| count_birth_order2/4 | -0.06652 | 0.07091 | -0.938 | -0.2055 | 0.07247 | fixed |
| count_birth_order3/4 | -0.06716 | 0.07791 | -0.862 | -0.2199 | 0.08554 | fixed |
| count_birth_order4/4 | -0.1452 | 0.08033 | -1.808 | -0.3026 | 0.01224 | fixed |
| count_birth_order1/5 | -0.1287 | 0.08259 | -1.559 | -0.2906 | 0.03312 | fixed |
| count_birth_order2/5 | -0.1947 | 0.08878 | -2.193 | -0.3687 | -0.02069 | fixed |
| count_birth_order3/5 | -0.1136 | 0.08636 | -1.316 | -0.2829 | 0.05564 | fixed |
| count_birth_order4/5 | -0.123 | 0.08956 | -1.373 | -0.2985 | 0.05257 | fixed |
| count_birth_order5/5 | 0.06422 | 0.08981 | 0.7151 | -0.1118 | 0.2403 | fixed |
| count_birth_order1/5+ | -0.1769 | 0.07848 | -2.255 | -0.3308 | -0.02313 | fixed |
| count_birth_order2/5+ | -0.1904 | 0.08206 | -2.32 | -0.3512 | -0.02953 | fixed |
| count_birth_order3/5+ | -0.1052 | 0.08055 | -1.306 | -0.2631 | 0.05268 | fixed |
| count_birth_order4/5+ | -0.07007 | 0.07755 | -0.9036 | -0.2221 | 0.08192 | fixed |
| count_birth_order5/5+ | -0.001767 | 0.07974 | -0.02216 | -0.1581 | 0.1545 | fixed |
| count_birth_order5+/5+ | -0.1002 | 0.05776 | -1.736 | -0.2135 | 0.01295 | fixed |
| sd_(Intercept).mother_pidlink | 0.1906 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9952 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 17123 | 17197 | -8551 | 17101 | NA | NA | NA |
| 12 | 17123 | 17203 | -8549 | 17099 | 2.6 | 1 | 0.1069 |
| 16 | 17124 | 17231 | -8546 | 17092 | 6.411 | 4 | 0.1705 |
| 26 | 17138 | 17312 | -8543 | 17086 | 6.211 | 10 | 0.7972 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.072 | 0.4545 | 2.359 | 0.1814 | 1.963 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.0908 | 0.05157 | -1.761 | -0.1919 | 0.01027 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003071 | 0.00184 | 1.669 | -0.0005349 | 0.006678 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00003239 | 0.00002084 | -1.555 | -0.00007324 | 0.000008448 | fixed |
| male | -0.2616 | 0.02657 | -9.846 | -0.3137 | -0.2095 | fixed |
| sibling_count3 | -0.04465 | 0.03971 | -1.124 | -0.1225 | 0.03318 | fixed |
| sibling_count4 | -0.08125 | 0.04277 | -1.899 | -0.1651 | 0.002591 | fixed |
| sibling_count5 | -0.115 | 0.05 | -2.3 | -0.213 | -0.01698 | fixed |
| sibling_count5+ | -0.1278 | 0.04315 | -2.963 | -0.2124 | -0.04327 | fixed |
| sd_(Intercept).mother_pidlink | 0.1898 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9926 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.06 | 0.4544 | 2.334 | 0.1698 | 1.951 | fixed |
| birth_order | 0.01785 | 0.008858 | 2.016 | 0.000492 | 0.03521 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.09181 | 0.05156 | -1.781 | -0.1929 | 0.009241 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003073 | 0.00184 | 1.671 | -0.0005322 | 0.006679 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00003172 | 0.00002084 | -1.522 | -0.00007256 | 0.000009117 | fixed |
| male | -0.262 | 0.02656 | -9.864 | -0.3141 | -0.2099 | fixed |
| sibling_count3 | -0.05323 | 0.03994 | -1.333 | -0.1315 | 0.02505 | fixed |
| sibling_count4 | -0.1011 | 0.0439 | -2.303 | -0.1871 | -0.01505 | fixed |
| sibling_count5 | -0.1465 | 0.0524 | -2.795 | -0.2492 | -0.04378 | fixed |
| sibling_count5+ | -0.1938 | 0.05419 | -3.576 | -0.3 | -0.08757 | fixed |
| sd_(Intercept).mother_pidlink | 0.1929 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9917 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.044 | 0.4546 | 2.297 | 0.1532 | 1.935 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.08873 | 0.05154 | -1.722 | -0.1898 | 0.01229 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.002964 | 0.001839 | 1.612 | -0.0006406 | 0.006569 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00003055 | 0.00002083 | -1.466 | -0.00007138 | 0.00001029 | fixed |
| male | -0.2626 | 0.02655 | -9.892 | -0.3147 | -0.2106 | fixed |
| sibling_count3 | -0.05612 | 0.04085 | -1.374 | -0.1362 | 0.02394 | fixed |
| sibling_count4 | -0.124 | 0.04582 | -2.706 | -0.2138 | -0.03419 | fixed |
| sibling_count5 | -0.1948 | 0.05506 | -3.537 | -0.3027 | -0.08684 | fixed |
| sibling_count5+ | -0.2001 | 0.05603 | -3.572 | -0.31 | -0.09033 | fixed |
| birth_order_nonlinear2 | 0.04114 | 0.03439 | 1.196 | -0.02627 | 0.1086 | fixed |
| birth_order_nonlinear3 | 0.05162 | 0.04243 | 1.217 | -0.03154 | 0.1348 | fixed |
| birth_order_nonlinear4 | 0.1592 | 0.05384 | 2.957 | 0.05366 | 0.2647 | fixed |
| birth_order_nonlinear5 | 0.2166 | 0.06823 | 3.175 | 0.0829 | 0.3503 | fixed |
| birth_order_nonlinear5+ | 0.04953 | 0.06681 | 0.7413 | -0.08142 | 0.1805 | fixed |
| sd_(Intercept).mother_pidlink | 0.1887 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9919 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.015 | 0.4558 | 2.227 | 0.1216 | 1.908 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.08443 | 0.05168 | -1.634 | -0.1857 | 0.01686 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.002813 | 0.001844 | 1.525 | -0.0008021 | 0.006427 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002887 | 0.0000209 | -1.382 | -0.00006982 | 0.00001209 | fixed |
| male | -0.2616 | 0.02658 | -9.842 | -0.3137 | -0.2095 | fixed |
| count_birth_order2/2 | 0.01484 | 0.06064 | 0.2447 | -0.104 | 0.1337 | fixed |
| count_birth_order1/3 | -0.09202 | 0.05348 | -1.721 | -0.1968 | 0.0128 | fixed |
| count_birth_order2/3 | 0.009075 | 0.05919 | 0.1533 | -0.1069 | 0.1251 | fixed |
| count_birth_order3/3 | -0.006927 | 0.06507 | -0.1065 | -0.1345 | 0.1206 | fixed |
| count_birth_order1/4 | -0.1042 | 0.06656 | -1.565 | -0.2346 | 0.02629 | fixed |
| count_birth_order2/4 | -0.1136 | 0.06851 | -1.658 | -0.2479 | 0.02067 | fixed |
| count_birth_order3/4 | -0.08828 | 0.07183 | -1.229 | -0.2291 | 0.0525 | fixed |
| count_birth_order4/4 | 0.02013 | 0.07593 | 0.2651 | -0.1287 | 0.169 | fixed |
| count_birth_order1/5 | -0.1585 | 0.08983 | -1.765 | -0.3346 | 0.01752 | fixed |
| count_birth_order2/5 | -0.151 | 0.09939 | -1.519 | -0.3458 | 0.04379 | fixed |
| count_birth_order3/5 | -0.1459 | 0.09485 | -1.538 | -0.3318 | 0.04 | fixed |
| count_birth_order4/5 | -0.05101 | 0.09137 | -0.5583 | -0.2301 | 0.1281 | fixed |
| count_birth_order5/5 | -0.05376 | 0.09711 | -0.5536 | -0.2441 | 0.1366 | fixed |
| count_birth_order1/5+ | -0.2499 | 0.09145 | -2.732 | -0.4291 | -0.07063 | fixed |
| count_birth_order2/5+ | -0.1872 | 0.09072 | -2.063 | -0.365 | -0.009383 | fixed |
| count_birth_order3/5+ | -0.1664 | 0.08997 | -1.85 | -0.3428 | 0.009894 | fixed |
| count_birth_order4/5+ | -0.03704 | 0.08803 | -0.4208 | -0.2096 | 0.1355 | fixed |
| count_birth_order5/5+ | 0.04899 | 0.0809 | 0.6055 | -0.1096 | 0.2076 | fixed |
| count_birth_order5+/5+ | -0.1598 | 0.05974 | -2.675 | -0.2769 | -0.04272 | fixed |
| sd_(Intercept).mother_pidlink | 0.1888 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9924 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 16605 | 16679 | -8292 | 16583 | NA | NA | NA |
| 12 | 16603 | 16683 | -8290 | 16579 | 4.058 | 1 | 0.04397 |
| 16 | 16600 | 16706 | -8284 | 16568 | 11.43 | 4 | 0.0221 |
| 26 | 16617 | 16790 | -8282 | 16565 | 3.206 | 10 | 0.9761 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = big5_neu)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.601 | 0.1581 | 3.801 | 0.2911 | 0.911 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.03614 | 0.01513 | -2.388 | -0.0658 | -0.006479 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0004516 | 0.0004443 | 1.016 | -0.0004192 | 0.001322 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000006353 | 0.000004084 | -0.1556 | -0.000008639 | 0.000007369 | fixed |
| male | 0.05519 | 0.01681 | 3.283 | 0.02224 | 0.08815 | fixed |
| sibling_count3 | 0.07441 | 0.03286 | 2.265 | 0.01002 | 0.1388 | fixed |
| sibling_count4 | 0.03297 | 0.03366 | 0.9794 | -0.033 | 0.09893 | fixed |
| sibling_count5 | 0.02561 | 0.03475 | 0.737 | -0.04249 | 0.09372 | fixed |
| sibling_count5+ | 0.004546 | 0.02748 | 0.1654 | -0.04932 | 0.05841 | fixed |
| sd_(Intercept).mother_pidlink | 0.1577 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9789 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.6006 | 0.1582 | 3.797 | 0.2906 | 0.9106 | fixed |
| birth_order | -0.0007634 | 0.003442 | -0.2218 | -0.00751 | 0.005983 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.03592 | 0.01517 | -2.368 | -0.06565 | -0.006189 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0004439 | 0.0004457 | 0.996 | -0.0004296 | 0.001317 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000005662 | 0.000004096 | -0.1382 | -0.000008594 | 0.000007461 | fixed |
| male | 0.05521 | 0.01681 | 3.284 | 0.02226 | 0.08817 | fixed |
| sibling_count3 | 0.07462 | 0.03287 | 2.27 | 0.01019 | 0.139 | fixed |
| sibling_count4 | 0.03352 | 0.03375 | 0.9932 | -0.03263 | 0.09968 | fixed |
| sibling_count5 | 0.02656 | 0.03501 | 0.7586 | -0.04206 | 0.09518 | fixed |
| sibling_count5+ | 0.007498 | 0.03054 | 0.2456 | -0.05235 | 0.06735 | fixed |
| sd_(Intercept).mother_pidlink | 0.1578 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9789 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.6011 | 0.1586 | 3.79 | 0.2902 | 0.9119 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.03675 | 0.01517 | -2.422 | -0.06649 | -0.007014 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0004618 | 0.0004458 | 1.036 | -0.0004119 | 0.001336 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000006348 | 0.000004097 | -0.1549 | -0.000008665 | 0.000007395 | fixed |
| male | 0.05494 | 0.01681 | 3.267 | 0.02198 | 0.08789 | fixed |
| sibling_count3 | 0.06849 | 0.0334 | 2.05 | 0.003023 | 0.134 | fixed |
| sibling_count4 | 0.02467 | 0.03487 | 0.7076 | -0.04366 | 0.09301 | fixed |
| sibling_count5 | 0.007275 | 0.0366 | 0.1987 | -0.06446 | 0.07901 | fixed |
| sibling_count5+ | -0.007381 | 0.03233 | -0.2283 | -0.07074 | 0.05598 | fixed |
| birth_order_nonlinear2 | 0.02011 | 0.02471 | 0.8138 | -0.02832 | 0.06853 | fixed |
| birth_order_nonlinear3 | 0.0327 | 0.02917 | 1.121 | -0.02447 | 0.08988 | fixed |
| birth_order_nonlinear4 | 0.02027 | 0.03321 | 0.6103 | -0.04482 | 0.08535 | fixed |
| birth_order_nonlinear5 | 0.07457 | 0.03775 | 1.975 | 0.000577 | 0.1486 | fixed |
| birth_order_nonlinear5+ | 0.008219 | 0.03081 | 0.2668 | -0.05217 | 0.06861 | fixed |
| sd_(Intercept).mother_pidlink | 0.1577 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9789 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5956 | 0.1593 | 3.739 | 0.2834 | 0.9079 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.0371 | 0.01518 | -2.444 | -0.06685 | -0.007352 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0004657 | 0.0004459 | 1.044 | -0.0004083 | 0.00134 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000006162 | 0.000004098 | -0.1504 | -0.000008649 | 0.000007416 | fixed |
| male | 0.05477 | 0.01682 | 3.256 | 0.0218 | 0.08774 | fixed |
| count_birth_order2/2 | 0.04968 | 0.04808 | 1.033 | -0.04456 | 0.1439 | fixed |
| count_birth_order1/3 | 0.09649 | 0.04475 | 2.156 | 0.008776 | 0.1842 | fixed |
| count_birth_order2/3 | 0.05696 | 0.05006 | 1.138 | -0.04115 | 0.1551 | fixed |
| count_birth_order3/3 | 0.1377 | 0.05609 | 2.454 | 0.02774 | 0.2476 | fixed |
| count_birth_order1/4 | 0.01046 | 0.05112 | 0.2045 | -0.08975 | 0.1107 | fixed |
| count_birth_order2/4 | 0.05887 | 0.05377 | 1.095 | -0.04652 | 0.1643 | fixed |
| count_birth_order3/4 | 0.08505 | 0.05844 | 1.455 | -0.02949 | 0.1996 | fixed |
| count_birth_order4/4 | 0.07642 | 0.06189 | 1.235 | -0.04488 | 0.1977 | fixed |
| count_birth_order1/5 | 0.004727 | 0.05803 | 0.08145 | -0.109 | 0.1185 | fixed |
| count_birth_order2/5 | 0.02951 | 0.06106 | 0.4834 | -0.09016 | 0.1492 | fixed |
| count_birth_order3/5 | 0.04063 | 0.06268 | 0.6482 | -0.08222 | 0.1635 | fixed |
| count_birth_order4/5 | 0.09274 | 0.06641 | 1.397 | -0.03742 | 0.2229 | fixed |
| count_birth_order5/5 | 0.08234 | 0.06789 | 1.213 | -0.05072 | 0.2154 | fixed |
| count_birth_order1/5+ | 0.02683 | 0.04688 | 0.5724 | -0.06505 | 0.1187 | fixed |
| count_birth_order2/5+ | 0.04649 | 0.04837 | 0.9612 | -0.04831 | 0.1413 | fixed |
| count_birth_order3/5+ | 0.01851 | 0.0474 | 0.3905 | -0.07439 | 0.1114 | fixed |
| count_birth_order4/5+ | -0.00249 | 0.04644 | -0.05362 | -0.09352 | 0.08854 | fixed |
| count_birth_order5/5+ | 0.08246 | 0.0468 | 1.762 | -0.00926 | 0.1742 | fixed |
| count_birth_order5+/5+ | 0.01226 | 0.03604 | 0.34 | -0.05839 | 0.0829 | fixed |
| sd_(Intercept).mother_pidlink | 0.1573 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9791 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 39311 | 39394 | -19645 | 39289 | NA | NA | NA |
| 12 | 39313 | 39404 | -19645 | 39289 | 0.04923 | 1 | 0.8244 |
| 16 | 39316 | 39437 | -19642 | 39284 | 4.979 | 4 | 0.2895 |
| 26 | 39331 | 39527 | -19639 | 39279 | 5.377 | 10 | 0.8646 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.07793 | 0.4239 | 0.1838 | -0.7529 | 0.9088 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02914 | 0.04807 | 0.6062 | -0.06508 | 0.1234 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002039 | 0.001714 | -1.19 | -0.005399 | 0.001321 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002818 | 0.0000194 | 1.453 | -0.000009837 | 0.00006621 | fixed |
| male | 0.03821 | 0.02483 | 1.539 | -0.01044 | 0.08687 | fixed |
| sibling_count3 | 0.09336 | 0.03775 | 2.473 | 0.01937 | 0.1673 | fixed |
| sibling_count4 | 0.06312 | 0.04032 | 1.565 | -0.01591 | 0.1421 | fixed |
| sibling_count5 | 0.06854 | 0.04567 | 1.501 | -0.02096 | 0.1581 | fixed |
| sibling_count5+ | 0.0178 | 0.03989 | 0.4463 | -0.06038 | 0.09599 | fixed |
| sd_(Intercept).mother_pidlink | 0.1006 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9484 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.08652 | 0.4239 | 0.2041 | -0.7444 | 0.9174 | fixed |
| birth_order | -0.01 | 0.008074 | -1.238 | -0.02583 | 0.005826 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02948 | 0.04807 | 0.6132 | -0.06474 | 0.1237 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002033 | 0.001714 | -1.186 | -0.005393 | 0.001327 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002773 | 0.0000194 | 1.429 | -0.00001029 | 0.00006576 | fixed |
| male | 0.03862 | 0.02483 | 1.555 | -0.01004 | 0.08728 | fixed |
| sibling_count3 | 0.09815 | 0.03795 | 2.586 | 0.02377 | 0.1725 | fixed |
| sibling_count4 | 0.07431 | 0.04132 | 1.798 | -0.006685 | 0.1553 | fixed |
| sibling_count5 | 0.08697 | 0.04803 | 1.811 | -0.007179 | 0.1811 | fixed |
| sibling_count5+ | 0.05496 | 0.04992 | 1.101 | -0.04289 | 0.1528 | fixed |
| sd_(Intercept).mother_pidlink | 0.1019 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9482 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.07131 | 0.4245 | 0.168 | -0.7607 | 0.9034 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0301 | 0.0481 | 0.6259 | -0.06416 | 0.1244 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002058 | 0.001715 | -1.2 | -0.00542 | 0.001304 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002808 | 0.00001942 | 1.446 | -0.000009974 | 0.00006614 | fixed |
| male | 0.03899 | 0.02483 | 1.57 | -0.009682 | 0.08766 | fixed |
| sibling_count3 | 0.09096 | 0.03885 | 2.341 | 0.0148 | 0.1671 | fixed |
| sibling_count4 | 0.07859 | 0.04319 | 1.819 | -0.006069 | 0.1633 | fixed |
| sibling_count5 | 0.08039 | 0.05089 | 1.58 | -0.01935 | 0.1801 | fixed |
| sibling_count5+ | 0.04368 | 0.05169 | 0.8451 | -0.05762 | 0.145 | fixed |
| birth_order_nonlinear2 | -0.01106 | 0.03269 | -0.3382 | -0.07513 | 0.05301 | fixed |
| birth_order_nonlinear3 | 0.01072 | 0.04018 | 0.2668 | -0.06803 | 0.08947 | fixed |
| birth_order_nonlinear4 | -0.08731 | 0.04954 | -1.762 | -0.1844 | 0.00979 | fixed |
| birth_order_nonlinear5 | 0.02271 | 0.06194 | 0.3667 | -0.0987 | 0.1441 | fixed |
| birth_order_nonlinear5+ | -0.0531 | 0.06103 | -0.8702 | -0.1727 | 0.06651 | fixed |
| sd_(Intercept).mother_pidlink | 0.1078 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9476 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.07141 | 0.4255 | 0.1678 | -0.7625 | 0.9053 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02803 | 0.04821 | 0.5815 | -0.06646 | 0.1225 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.001994 | 0.00172 | -1.159 | -0.005364 | 0.001377 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002749 | 0.00001947 | 1.412 | -0.00001067 | 0.00006564 | fixed |
| male | 0.03836 | 0.02486 | 1.543 | -0.01036 | 0.08708 | fixed |
| count_birth_order2/2 | 0.04808 | 0.059 | 0.815 | -0.06756 | 0.1637 | fixed |
| count_birth_order1/3 | 0.1422 | 0.05114 | 2.781 | 0.04197 | 0.2424 | fixed |
| count_birth_order2/3 | 0.08164 | 0.05592 | 1.46 | -0.02797 | 0.1912 | fixed |
| count_birth_order3/3 | 0.08769 | 0.06257 | 1.401 | -0.03495 | 0.2103 | fixed |
| count_birth_order1/4 | 0.1145 | 0.06254 | 1.831 | -0.00807 | 0.2371 | fixed |
| count_birth_order2/4 | 0.08613 | 0.06479 | 1.329 | -0.04086 | 0.2131 | fixed |
| count_birth_order3/4 | 0.07842 | 0.06855 | 1.144 | -0.05593 | 0.2128 | fixed |
| count_birth_order4/4 | 0.02476 | 0.07127 | 0.3474 | -0.1149 | 0.1645 | fixed |
| count_birth_order1/5 | 0.06937 | 0.08504 | 0.8157 | -0.09731 | 0.236 | fixed |
| count_birth_order2/5 | 0.03969 | 0.09114 | 0.4355 | -0.1389 | 0.2183 | fixed |
| count_birth_order3/5 | 0.1673 | 0.08546 | 1.958 | -0.0002078 | 0.3348 | fixed |
| count_birth_order4/5 | 0.0241 | 0.08231 | 0.2927 | -0.1372 | 0.1854 | fixed |
| count_birth_order5/5 | 0.1299 | 0.08569 | 1.516 | -0.03808 | 0.2978 | fixed |
| count_birth_order1/5+ | 0.0308 | 0.08431 | 0.3653 | -0.1344 | 0.196 | fixed |
| count_birth_order2/5+ | 0.05316 | 0.08353 | 0.6365 | -0.1105 | 0.2169 | fixed |
| count_birth_order3/5+ | 0.1418 | 0.08377 | 1.693 | -0.02237 | 0.306 | fixed |
| count_birth_order4/5+ | -0.0495 | 0.07896 | -0.6269 | -0.2043 | 0.1053 | fixed |
| count_birth_order5/5+ | 0.08194 | 0.07463 | 1.098 | -0.06433 | 0.2282 | fixed |
| count_birth_order5+/5+ | 0.01088 | 0.05522 | 0.1971 | -0.09735 | 0.1191 | fixed |
| sd_(Intercept).mother_pidlink | 0.1066 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9481 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 16263 | 16336 | -8120 | 16241 | NA | NA | NA |
| 12 | 16263 | 16343 | -8120 | 16239 | 1.535 | 1 | 0.2154 |
| 16 | 16268 | 16375 | -8118 | 16236 | 3.665 | 4 | 0.4532 |
| 26 | 16283 | 16456 | -8115 | 16231 | 4.968 | 10 | 0.8933 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.0317 | 0.4229 | 0.07496 | -0.7972 | 0.8606 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.03346 | 0.04798 | 0.6974 | -0.06058 | 0.1275 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002179 | 0.001712 | -1.273 | -0.005534 | 0.001175 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002954 | 0.00001937 | 1.525 | -0.000008427 | 0.00006751 | fixed |
| male | 0.04097 | 0.02475 | 1.655 | -0.007543 | 0.08948 | fixed |
| sibling_count3 | 0.08282 | 0.04092 | 2.024 | 0.002613 | 0.163 | fixed |
| sibling_count4 | 0.06103 | 0.04287 | 1.424 | -0.02299 | 0.145 | fixed |
| sibling_count5 | 0.0811 | 0.04553 | 1.781 | -0.008131 | 0.1703 | fixed |
| sibling_count5+ | 0.03651 | 0.03994 | 0.9141 | -0.04178 | 0.1148 | fixed |
| sd_(Intercept).mother_pidlink | 0.1005 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9493 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.04441 | 0.4229 | 0.105 | -0.7845 | 0.8733 | fixed |
| birth_order | -0.01109 | 0.00701 | -1.582 | -0.02483 | 0.00265 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.03346 | 0.04798 | 0.6974 | -0.06057 | 0.1275 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002159 | 0.001711 | -1.261 | -0.005513 | 0.001196 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002889 | 0.00001937 | 1.491 | -0.000009077 | 0.00006686 | fixed |
| male | 0.0413 | 0.02475 | 1.669 | -0.007202 | 0.08981 | fixed |
| sibling_count3 | 0.0881 | 0.04106 | 2.146 | 0.007622 | 0.1686 | fixed |
| sibling_count4 | 0.07293 | 0.04353 | 1.675 | -0.01238 | 0.1582 | fixed |
| sibling_count5 | 0.09992 | 0.04706 | 2.123 | 0.007676 | 0.1922 | fixed |
| sibling_count5+ | 0.07683 | 0.0474 | 1.621 | -0.01606 | 0.1697 | fixed |
| sd_(Intercept).mother_pidlink | 0.1033 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9489 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.03876 | 0.4231 | 0.09161 | -0.7906 | 0.8681 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.03369 | 0.04797 | 0.7023 | -0.06032 | 0.1277 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002167 | 0.001711 | -1.266 | -0.005521 | 0.001187 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000029 | 0.00001937 | 1.497 | -0.000008971 | 0.00006698 | fixed |
| male | 0.04192 | 0.02474 | 1.695 | -0.006566 | 0.0904 | fixed |
| sibling_count3 | 0.07471 | 0.04189 | 1.784 | -0.007392 | 0.1568 | fixed |
| sibling_count4 | 0.0765 | 0.04525 | 1.69 | -0.01219 | 0.1652 | fixed |
| sibling_count5 | 0.08472 | 0.04963 | 1.707 | -0.01255 | 0.182 | fixed |
| sibling_count5+ | 0.06516 | 0.0491 | 1.327 | -0.03107 | 0.1614 | fixed |
| birth_order_nonlinear2 | -0.03395 | 0.03325 | -1.021 | -0.09911 | 0.03121 | fixed |
| birth_order_nonlinear3 | 0.0351 | 0.04 | 0.8776 | -0.04329 | 0.1135 | fixed |
| birth_order_nonlinear4 | -0.1214 | 0.04801 | -2.528 | -0.2155 | -0.02729 | fixed |
| birth_order_nonlinear5 | 0.04432 | 0.0589 | 0.7524 | -0.07113 | 0.1598 | fixed |
| birth_order_nonlinear5+ | -0.07547 | 0.05434 | -1.389 | -0.182 | 0.03104 | fixed |
| sd_(Intercept).mother_pidlink | 0.1105 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9475 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.03366 | 0.424 | 0.07939 | -0.7973 | 0.8646 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.03155 | 0.04804 | 0.6567 | -0.06261 | 0.1257 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002097 | 0.001714 | -1.223 | -0.005457 | 0.001263 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002826 | 0.00001941 | 1.456 | -0.000009788 | 0.00006631 | fixed |
| male | 0.04179 | 0.02476 | 1.688 | -0.00673 | 0.09032 | fixed |
| count_birth_order2/2 | 0.03961 | 0.0645 | 0.6141 | -0.0868 | 0.166 | fixed |
| count_birth_order1/3 | 0.1374 | 0.05538 | 2.481 | 0.02883 | 0.2459 | fixed |
| count_birth_order2/3 | 0.0286 | 0.0601 | 0.4759 | -0.0892 | 0.1464 | fixed |
| count_birth_order3/3 | 0.1168 | 0.0677 | 1.725 | -0.01592 | 0.2495 | fixed |
| count_birth_order1/4 | 0.0847 | 0.06551 | 1.293 | -0.04369 | 0.2131 | fixed |
| count_birth_order2/4 | 0.05894 | 0.0668 | 0.8824 | -0.07198 | 0.1899 | fixed |
| count_birth_order3/4 | 0.1447 | 0.0734 | 1.971 | 0.0008398 | 0.2886 | fixed |
| count_birth_order4/4 | 0.01153 | 0.07568 | 0.1524 | -0.1368 | 0.1599 | fixed |
| count_birth_order1/5 | 0.09265 | 0.07779 | 1.191 | -0.05981 | 0.2451 | fixed |
| count_birth_order2/5 | 0.09271 | 0.08364 | 1.109 | -0.07121 | 0.2566 | fixed |
| count_birth_order3/5 | 0.1264 | 0.08136 | 1.553 | -0.03309 | 0.2859 | fixed |
| count_birth_order4/5 | 0.04972 | 0.08439 | 0.5892 | -0.1157 | 0.2151 | fixed |
| count_birth_order5/5 | 0.1191 | 0.08463 | 1.407 | -0.04679 | 0.2849 | fixed |
| count_birth_order1/5+ | 0.1082 | 0.0739 | 1.465 | -0.03659 | 0.2531 | fixed |
| count_birth_order2/5+ | 0.0554 | 0.07728 | 0.7169 | -0.09607 | 0.2069 | fixed |
| count_birth_order3/5+ | 0.1571 | 0.07588 | 2.07 | 0.008331 | 0.3058 | fixed |
| count_birth_order4/5+ | -0.09833 | 0.07306 | -1.346 | -0.2415 | 0.04487 | fixed |
| count_birth_order5/5+ | 0.1605 | 0.07513 | 2.136 | 0.01323 | 0.3078 | fixed |
| count_birth_order5+/5+ | 0.01527 | 0.05421 | 0.2817 | -0.09098 | 0.1215 | fixed |
| sd_(Intercept).mother_pidlink | 0.1101 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9479 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 16414 | 16488 | -8196 | 16392 | NA | NA | NA |
| 12 | 16414 | 16494 | -8195 | 16390 | 2.502 | 1 | 0.1137 |
| 16 | 16410 | 16517 | -8189 | 16378 | 11.42 | 4 | 0.02226 |
| 26 | 16424 | 16598 | -8186 | 16372 | 6.095 | 10 | 0.8072 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2053 | 0.4296 | 0.4778 | -0.6367 | 1.047 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01525 | 0.04874 | 0.3129 | -0.08027 | 0.1108 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00156 | 0.001739 | -0.8973 | -0.004968 | 0.001848 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000229 | 0.00001968 | 1.163 | -0.00001569 | 0.00006148 | fixed |
| male | 0.0369 | 0.02513 | 1.468 | -0.01235 | 0.08614 | fixed |
| sibling_count3 | 0.08947 | 0.03732 | 2.398 | 0.01633 | 0.1626 | fixed |
| sibling_count4 | 0.03919 | 0.04012 | 0.9767 | -0.03945 | 0.1178 | fixed |
| sibling_count5 | 0.05698 | 0.04679 | 1.218 | -0.03473 | 0.1487 | fixed |
| sibling_count5+ | 0.03513 | 0.04032 | 0.8712 | -0.0439 | 0.1142 | fixed |
| sd_(Intercept).mother_pidlink | 0.1033 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9496 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.214 | 0.4296 | 0.4982 | -0.6279 | 1.056 | fixed |
| birth_order | -0.01305 | 0.008345 | -1.564 | -0.02941 | 0.003305 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01595 | 0.04873 | 0.3273 | -0.07957 | 0.1115 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00156 | 0.001738 | -0.8971 | -0.004967 | 0.001848 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002239 | 0.00001969 | 1.137 | -0.00001619 | 0.00006097 | fixed |
| male | 0.0372 | 0.02513 | 1.481 | -0.01205 | 0.08644 | fixed |
| sibling_count3 | 0.09572 | 0.03753 | 2.551 | 0.02217 | 0.1693 | fixed |
| sibling_count4 | 0.05364 | 0.04117 | 1.303 | -0.02705 | 0.1343 | fixed |
| sibling_count5 | 0.07992 | 0.04903 | 1.63 | -0.01618 | 0.176 | fixed |
| sibling_count5+ | 0.0833 | 0.05074 | 1.642 | -0.01615 | 0.1828 | fixed |
| sd_(Intercept).mother_pidlink | 0.1035 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9495 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1918 | 0.4301 | 0.446 | -0.6511 | 1.035 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01694 | 0.04875 | 0.3474 | -0.07861 | 0.1125 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.001603 | 0.001739 | -0.9217 | -0.005012 | 0.001806 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002304 | 0.0000197 | 1.17 | -0.00001556 | 0.00006165 | fixed |
| male | 0.03758 | 0.02513 | 1.495 | -0.01167 | 0.08683 | fixed |
| sibling_count3 | 0.08919 | 0.03845 | 2.319 | 0.01382 | 0.1646 | fixed |
| sibling_count4 | 0.05798 | 0.04308 | 1.346 | -0.02646 | 0.1424 | fixed |
| sibling_count5 | 0.06803 | 0.05169 | 1.316 | -0.03328 | 0.1693 | fixed |
| sibling_count5+ | 0.06393 | 0.05261 | 1.215 | -0.03918 | 0.167 | fixed |
| birth_order_nonlinear2 | -0.009548 | 0.03268 | -0.2922 | -0.0736 | 0.05451 | fixed |
| birth_order_nonlinear3 | 0.001187 | 0.04029 | 0.02947 | -0.07777 | 0.08015 | fixed |
| birth_order_nonlinear4 | -0.09376 | 0.05109 | -1.835 | -0.1939 | 0.006373 | fixed |
| birth_order_nonlinear5 | 0.04599 | 0.06475 | 0.7104 | -0.08091 | 0.1729 | fixed |
| birth_order_nonlinear5+ | -0.06619 | 0.06315 | -1.048 | -0.19 | 0.05759 | fixed |
| sd_(Intercept).mother_pidlink | 0.1082 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.949 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1918 | 0.4311 | 0.4448 | -0.6532 | 1.037 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01537 | 0.04887 | 0.3146 | -0.08041 | 0.1112 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.001561 | 0.001744 | -0.8951 | -0.004978 | 0.001857 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002274 | 0.00001975 | 1.151 | -0.00001597 | 0.00006145 | fixed |
| male | 0.03747 | 0.02516 | 1.49 | -0.01183 | 0.08678 | fixed |
| count_birth_order2/2 | 0.03766 | 0.0576 | 0.6538 | -0.07524 | 0.1505 | fixed |
| count_birth_order1/3 | 0.1411 | 0.05059 | 2.789 | 0.04195 | 0.2402 | fixed |
| count_birth_order2/3 | 0.07607 | 0.056 | 1.358 | -0.03368 | 0.1858 | fixed |
| count_birth_order3/3 | 0.06606 | 0.06157 | 1.073 | -0.05462 | 0.1867 | fixed |
| count_birth_order1/4 | 0.08699 | 0.06296 | 1.382 | -0.03641 | 0.2104 | fixed |
| count_birth_order2/4 | 0.05859 | 0.06481 | 0.904 | -0.06844 | 0.1856 | fixed |
| count_birth_order3/4 | 0.06053 | 0.06797 | 0.8905 | -0.07269 | 0.1937 | fixed |
| count_birth_order4/4 | -0.01195 | 0.07185 | -0.1663 | -0.1528 | 0.1289 | fixed |
| count_birth_order1/5 | 0.06638 | 0.08497 | 0.7812 | -0.1002 | 0.2329 | fixed |
| count_birth_order2/5 | 0.05185 | 0.09403 | 0.5514 | -0.1324 | 0.2362 | fixed |
| count_birth_order3/5 | 0.1164 | 0.08975 | 1.297 | -0.05947 | 0.2923 | fixed |
| count_birth_order4/5 | 0.004368 | 0.08646 | 0.05052 | -0.1651 | 0.1738 | fixed |
| count_birth_order5/5 | 0.1259 | 0.09189 | 1.37 | -0.05423 | 0.306 | fixed |
| count_birth_order1/5+ | 0.002119 | 0.08648 | 0.02451 | -0.1674 | 0.1716 | fixed |
| count_birth_order2/5+ | 0.07657 | 0.08579 | 0.8925 | -0.09158 | 0.2447 | fixed |
| count_birth_order3/5+ | 0.1699 | 0.08512 | 1.996 | 0.003086 | 0.3367 | fixed |
| count_birth_order4/5+ | -0.03566 | 0.08329 | -0.4281 | -0.1989 | 0.1276 | fixed |
| count_birth_order5/5+ | 0.1293 | 0.07655 | 1.689 | -0.02071 | 0.2794 | fixed |
| count_birth_order5+/5+ | 0.01442 | 0.05626 | 0.2563 | -0.09585 | 0.1247 | fixed |
| sd_(Intercept).mother_pidlink | 0.106 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9496 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 15955 | 16028 | -7966 | 15933 | NA | NA | NA |
| 12 | 15954 | 16034 | -7965 | 15930 | 2.449 | 1 | 0.1176 |
| 16 | 15958 | 16065 | -7963 | 15926 | 3.912 | 4 | 0.418 |
| 26 | 15973 | 16146 | -7961 | 15921 | 5.381 | 10 | 0.8643 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = big5_con)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.384 | 0.1564 | -8.846 | -1.69 | -1.077 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.07934 | 0.01497 | 5.299 | 0.04999 | 0.1087 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.001195 | 0.0004398 | -2.718 | -0.002057 | -0.0003333 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000005148 | 0.000004043 | 1.273 | -0.000002777 | 0.00001307 | fixed |
| male | 0.0443 | 0.01659 | 2.669 | 0.01177 | 0.07682 | fixed |
| sibling_count3 | -0.01129 | 0.03263 | -0.346 | -0.07525 | 0.05267 | fixed |
| sibling_count4 | -0.01053 | 0.03347 | -0.3145 | -0.07613 | 0.05508 | fixed |
| sibling_count5 | -0.0000886 | 0.03461 | -0.00256 | -0.06792 | 0.06775 | fixed |
| sibling_count5+ | 0.02139 | 0.02733 | 0.7829 | -0.03217 | 0.07495 | fixed |
| sd_(Intercept).mother_pidlink | 0.2052 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9578 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.384 | 0.1564 | -8.85 | -1.691 | -1.078 | fixed |
| birth_order | -0.001557 | 0.003422 | -0.4549 | -0.008263 | 0.00515 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0798 | 0.01501 | 5.317 | 0.05038 | 0.1092 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.001211 | 0.0004412 | -2.745 | -0.002076 | -0.0003464 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000005292 | 0.000004056 | 1.305 | -0.000002658 | 0.00001324 | fixed |
| male | 0.04434 | 0.0166 | 2.672 | 0.01181 | 0.07687 | fixed |
| sibling_count3 | -0.01089 | 0.03265 | -0.3337 | -0.07488 | 0.05309 | fixed |
| sibling_count4 | -0.009402 | 0.03357 | -0.2801 | -0.07519 | 0.05639 | fixed |
| sibling_count5 | 0.00183 | 0.03487 | 0.05247 | -0.06652 | 0.07017 | fixed |
| sibling_count5+ | 0.02738 | 0.03034 | 0.9025 | -0.03208 | 0.08683 | fixed |
| sd_(Intercept).mother_pidlink | 0.2055 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9578 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.373 | 0.1568 | -8.753 | -1.68 | -1.066 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.07988 | 0.01501 | 5.32 | 0.05045 | 0.1093 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.001203 | 0.0004413 | -2.726 | -0.002068 | -0.0003381 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000005103 | 0.000004057 | 1.258 | -0.000002848 | 0.00001305 | fixed |
| male | 0.04452 | 0.0166 | 2.682 | 0.01199 | 0.07704 | fixed |
| sibling_count3 | -0.004833 | 0.03316 | -0.1457 | -0.06983 | 0.06016 | fixed |
| sibling_count4 | -0.003616 | 0.03464 | -0.1044 | -0.07151 | 0.06427 | fixed |
| sibling_count5 | 0.01333 | 0.0364 | 0.3662 | -0.05802 | 0.08468 | fixed |
| sibling_count5+ | 0.0351 | 0.03206 | 1.095 | -0.02774 | 0.09794 | fixed |
| birth_order_nonlinear2 | -0.04456 | 0.02432 | -1.832 | -0.09222 | 0.003106 | fixed |
| birth_order_nonlinear3 | -0.04247 | 0.02871 | -1.479 | -0.09874 | 0.01381 | fixed |
| birth_order_nonlinear4 | -0.01607 | 0.03269 | -0.4915 | -0.08014 | 0.048 | fixed |
| birth_order_nonlinear5 | -0.06266 | 0.03717 | -1.686 | -0.1355 | 0.01018 | fixed |
| birth_order_nonlinear5+ | -0.03018 | 0.03045 | -0.9914 | -0.08986 | 0.02949 | fixed |
| sd_(Intercept).mother_pidlink | 0.2051 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9578 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.345 | 0.1575 | -8.541 | -1.654 | -1.037 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08008 | 0.01501 | 5.333 | 0.05065 | 0.1095 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.001199 | 0.0004413 | -2.717 | -0.002064 | -0.0003343 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000004988 | 0.000004057 | 1.229 | -0.000002965 | 0.00001294 | fixed |
| male | 0.0447 | 0.0166 | 2.693 | 0.01217 | 0.07723 | fixed |
| count_birth_order2/2 | -0.1323 | 0.04729 | -2.798 | -0.225 | -0.03964 | fixed |
| count_birth_order1/3 | -0.05977 | 0.0442 | -1.352 | -0.1464 | 0.02685 | fixed |
| count_birth_order2/3 | -0.05331 | 0.04943 | -1.078 | -0.1502 | 0.04357 | fixed |
| count_birth_order3/3 | -0.07588 | 0.05538 | -1.37 | -0.1844 | 0.03267 | fixed |
| count_birth_order1/4 | -0.03678 | 0.05048 | -0.7286 | -0.1357 | 0.06216 | fixed |
| count_birth_order2/4 | -0.08135 | 0.0531 | -1.532 | -0.1854 | 0.02271 | fixed |
| count_birth_order3/4 | -0.0356 | 0.0577 | -0.6169 | -0.1487 | 0.07749 | fixed |
| count_birth_order4/4 | -0.1034 | 0.0611 | -1.692 | -0.2231 | 0.01639 | fixed |
| count_birth_order1/5 | 0.02975 | 0.0573 | 0.5192 | -0.08256 | 0.1421 | fixed |
| count_birth_order2/5 | -0.03593 | 0.06028 | -0.596 | -0.1541 | 0.08222 | fixed |
| count_birth_order3/5 | -0.08495 | 0.06188 | -1.373 | -0.2062 | 0.03633 | fixed |
| count_birth_order4/5 | -0.04652 | 0.06556 | -0.7095 | -0.175 | 0.08198 | fixed |
| count_birth_order5/5 | -0.1564 | 0.06702 | -2.333 | -0.2877 | -0.02501 | fixed |
| count_birth_order1/5+ | -0.04653 | 0.04629 | -1.005 | -0.1372 | 0.04419 | fixed |
| count_birth_order2/5+ | -0.02981 | 0.04775 | -0.6243 | -0.1234 | 0.06378 | fixed |
| count_birth_order3/5+ | -0.05692 | 0.04679 | -1.217 | -0.1486 | 0.03478 | fixed |
| count_birth_order4/5+ | 0.01003 | 0.04585 | 0.2187 | -0.07983 | 0.09989 | fixed |
| count_birth_order5/5+ | -0.03622 | 0.04619 | -0.7841 | -0.1268 | 0.05432 | fixed |
| count_birth_order5+/5+ | -0.02832 | 0.0357 | -0.7933 | -0.0983 | 0.04165 | fixed |
| sd_(Intercept).mother_pidlink | 0.2051 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9577 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 38959 | 39042 | -19468 | 38937 | NA | NA | NA |
| 12 | 38960 | 39051 | -19468 | 38936 | 0.2064 | 1 | 0.6496 |
| 16 | 38963 | 39084 | -19466 | 38931 | 5.284 | 4 | 0.2594 |
| 26 | 38971 | 39167 | -19459 | 38919 | 12.56 | 10 | 0.2493 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8647 | 0.4405 | -1.963 | -1.728 | -0.001376 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01416 | 0.04997 | 0.2834 | -0.08377 | 0.1121 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001255 | 0.001782 | 0.7039 | -0.002239 | 0.004748 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002195 | 0.00002018 | -1.088 | -0.0000615 | 0.0000176 | fixed |
| male | 0.05224 | 0.02578 | 2.026 | 0.001712 | 0.1028 | fixed |
| sibling_count3 | -0.02611 | 0.03958 | -0.6597 | -0.1037 | 0.05147 | fixed |
| sibling_count4 | -0.04355 | 0.0424 | -1.027 | -0.1266 | 0.03955 | fixed |
| sibling_count5 | -0.01096 | 0.04815 | -0.2276 | -0.1053 | 0.08342 | fixed |
| sibling_count5+ | 0.03937 | 0.04215 | 0.9341 | -0.04324 | 0.122 | fixed |
| sd_(Intercept).mother_pidlink | 0.2157 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9676 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.85 | 0.4404 | -1.93 | -1.713 | 0.01315 | fixed |
| birth_order | -0.01736 | 0.008434 | -2.058 | -0.03389 | -0.0008289 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01482 | 0.04995 | 0.2967 | -0.08309 | 0.1127 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001262 | 0.001782 | 0.7084 | -0.00223 | 0.004755 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000227 | 0.00002018 | -1.125 | -0.00006225 | 0.00001684 | fixed |
| male | 0.05295 | 0.02577 | 2.054 | 0.002433 | 0.1035 | fixed |
| sibling_count3 | -0.01776 | 0.03978 | -0.4464 | -0.09573 | 0.06021 | fixed |
| sibling_count4 | -0.02394 | 0.04345 | -0.551 | -0.1091 | 0.06122 | fixed |
| sibling_count5 | 0.02124 | 0.05063 | 0.4196 | -0.07798 | 0.1205 | fixed |
| sibling_count5+ | 0.1041 | 0.0526 | 1.98 | 0.00106 | 0.2072 | fixed |
| sd_(Intercept).mother_pidlink | 0.2163 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9672 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8407 | 0.4411 | -1.906 | -1.705 | 0.02385 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01289 | 0.04999 | 0.2579 | -0.08509 | 0.1109 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001337 | 0.001783 | 0.7497 | -0.002159 | 0.004833 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002361 | 0.00002019 | -1.169 | -0.00006319 | 0.00001597 | fixed |
| male | 0.05276 | 0.02578 | 2.046 | 0.002225 | 0.1033 | fixed |
| sibling_count3 | -0.01599 | 0.04069 | -0.393 | -0.09574 | 0.06376 | fixed |
| sibling_count4 | -0.01708 | 0.04533 | -0.3768 | -0.1059 | 0.07176 | fixed |
| sibling_count5 | 0.02747 | 0.05349 | 0.5135 | -0.07737 | 0.1323 | fixed |
| sibling_count5+ | 0.1085 | 0.05435 | 1.997 | 0.002011 | 0.215 | fixed |
| birth_order_nonlinear2 | -0.05026 | 0.03374 | -1.49 | -0.1164 | 0.01586 | fixed |
| birth_order_nonlinear3 | -0.04458 | 0.04152 | -1.074 | -0.126 | 0.0368 | fixed |
| birth_order_nonlinear4 | -0.08636 | 0.05124 | -1.685 | -0.1868 | 0.01408 | fixed |
| birth_order_nonlinear5 | -0.08063 | 0.06405 | -1.259 | -0.2062 | 0.04491 | fixed |
| birth_order_nonlinear5+ | -0.127 | 0.06351 | -2 | -0.2515 | -0.002564 | fixed |
| sd_(Intercept).mother_pidlink | 0.2164 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9674 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8614 | 0.4418 | -1.95 | -1.727 | 0.004539 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01798 | 0.05007 | 0.3591 | -0.08016 | 0.1161 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001121 | 0.001787 | 0.6275 | -0.002381 | 0.004623 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002076 | 0.00002023 | -1.026 | -0.00006042 | 0.0000189 | fixed |
| male | 0.05421 | 0.02579 | 2.102 | 0.003657 | 0.1048 | fixed |
| count_birth_order2/2 | -0.1018 | 0.06088 | -1.672 | -0.2211 | 0.01753 | fixed |
| count_birth_order1/3 | -0.004458 | 0.05311 | -0.08395 | -0.1085 | 0.09963 | fixed |
| count_birth_order2/3 | -0.1003 | 0.05806 | -1.727 | -0.2141 | 0.01355 | fixed |
| count_birth_order3/3 | -0.1107 | 0.06495 | -1.705 | -0.238 | 0.01658 | fixed |
| count_birth_order1/4 | -0.05653 | 0.06495 | -0.8703 | -0.1838 | 0.07077 | fixed |
| count_birth_order2/4 | -0.05995 | 0.06727 | -0.8911 | -0.1918 | 0.0719 | fixed |
| count_birth_order3/4 | -0.02575 | 0.07114 | -0.362 | -0.1652 | 0.1137 | fixed |
| count_birth_order4/4 | -0.1802 | 0.07397 | -2.437 | -0.3252 | -0.03527 | fixed |
| count_birth_order1/5 | -0.09011 | 0.0883 | -1.021 | -0.2632 | 0.08294 | fixed |
| count_birth_order2/5 | 0.09637 | 0.0946 | 1.019 | -0.08904 | 0.2818 | fixed |
| count_birth_order3/5 | 0.02785 | 0.08869 | 0.314 | -0.146 | 0.2017 | fixed |
| count_birth_order4/5 | -0.06482 | 0.08542 | -0.7588 | -0.2322 | 0.1026 | fixed |
| count_birth_order5/5 | -0.1599 | 0.08892 | -1.798 | -0.3341 | 0.01441 | fixed |
| count_birth_order1/5+ | 0.03187 | 0.08759 | 0.3638 | -0.1398 | 0.2035 | fixed |
| count_birth_order2/5+ | 0.01605 | 0.08675 | 0.1851 | -0.154 | 0.1861 | fixed |
| count_birth_order3/5+ | -0.03007 | 0.08697 | -0.3458 | -0.2005 | 0.1404 | fixed |
| count_birth_order4/5+ | 0.06919 | 0.08196 | 0.8442 | -0.09145 | 0.2298 | fixed |
| count_birth_order5/5+ | 0.07304 | 0.07745 | 0.943 | -0.07876 | 0.2249 | fixed |
| count_birth_order5+/5+ | -0.03498 | 0.05771 | -0.6062 | -0.1481 | 0.07812 | fixed |
| sd_(Intercept).mother_pidlink | 0.2171 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.967 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 16715 | 16788 | -8346 | 16693 | NA | NA | NA |
| 12 | 16713 | 16793 | -8344 | 16689 | 4.241 | 1 | 0.03947 |
| 16 | 16719 | 16826 | -8344 | 16687 | 1.514 | 4 | 0.8241 |
| 26 | 16726 | 16900 | -8337 | 16674 | 13.11 | 10 | 0.2177 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8294 | 0.439 | -1.889 | -1.69 | 0.03101 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01291 | 0.04982 | 0.259 | -0.08475 | 0.1106 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001314 | 0.001778 | 0.7389 | -0.002171 | 0.004798 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002253 | 0.00002013 | -1.12 | -0.00006198 | 0.00001692 | fixed |
| male | 0.05108 | 0.02567 | 1.99 | 0.0007665 | 0.1014 | fixed |
| sibling_count3 | -0.06959 | 0.04285 | -1.624 | -0.1536 | 0.01439 | fixed |
| sibling_count4 | -0.06697 | 0.04498 | -1.489 | -0.1551 | 0.0212 | fixed |
| sibling_count5 | -0.0582 | 0.04789 | -1.215 | -0.1521 | 0.03566 | fixed |
| sibling_count5+ | -0.01844 | 0.04201 | -0.4389 | -0.1008 | 0.06391 | fixed |
| sd_(Intercept).mother_pidlink | 0.2172 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9672 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8205 | 0.4391 | -1.869 | -1.681 | 0.04006 | fixed |
| birth_order | -0.007815 | 0.007334 | -1.066 | -0.02219 | 0.00656 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01293 | 0.04982 | 0.2596 | -0.08472 | 0.1106 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001327 | 0.001778 | 0.7463 | -0.002158 | 0.004811 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002298 | 0.00002013 | -1.141 | -0.00006244 | 0.00001648 | fixed |
| male | 0.05132 | 0.02567 | 1.999 | 0.001008 | 0.1016 | fixed |
| sibling_count3 | -0.06585 | 0.04299 | -1.532 | -0.1501 | 0.01842 | fixed |
| sibling_count4 | -0.0585 | 0.04568 | -1.281 | -0.148 | 0.03103 | fixed |
| sibling_count5 | -0.04485 | 0.04951 | -0.9058 | -0.1419 | 0.05219 | fixed |
| sibling_count5+ | 0.01003 | 0.0498 | 0.2014 | -0.08757 | 0.1076 | fixed |
| sd_(Intercept).mother_pidlink | 0.2179 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.967 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.7972 | 0.4396 | -1.813 | -1.659 | 0.06439 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01086 | 0.04984 | 0.2178 | -0.08683 | 0.1085 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001404 | 0.001779 | 0.7896 | -0.002082 | 0.004891 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002385 | 0.00002015 | -1.184 | -0.00006333 | 0.00001563 | fixed |
| male | 0.05093 | 0.02568 | 1.983 | 0.0006034 | 0.1013 | fixed |
| sibling_count3 | -0.05132 | 0.04384 | -1.171 | -0.1372 | 0.0346 | fixed |
| sibling_count4 | -0.04716 | 0.04742 | -0.9943 | -0.1401 | 0.04579 | fixed |
| sibling_count5 | -0.03619 | 0.0521 | -0.6946 | -0.1383 | 0.06592 | fixed |
| sibling_count5+ | 0.01453 | 0.0515 | 0.2822 | -0.0864 | 0.1155 | fixed |
| birth_order_nonlinear2 | -0.0495 | 0.03432 | -1.442 | -0.1168 | 0.01776 | fixed |
| birth_order_nonlinear3 | -0.08248 | 0.04134 | -1.995 | -0.1635 | -0.00145 | fixed |
| birth_order_nonlinear4 | -0.02223 | 0.04967 | -0.4476 | -0.1196 | 0.07511 | fixed |
| birth_order_nonlinear5 | -0.04183 | 0.06094 | -0.6863 | -0.1613 | 0.07762 | fixed |
| birth_order_nonlinear5+ | -0.0672 | 0.05659 | -1.187 | -0.1781 | 0.04372 | fixed |
| sd_(Intercept).mother_pidlink | 0.2171 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9672 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8331 | 0.4403 | -1.892 | -1.696 | 0.02997 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01647 | 0.04991 | 0.3301 | -0.08135 | 0.1143 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001182 | 0.001781 | 0.6636 | -0.002309 | 0.004674 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002112 | 0.00002018 | -1.047 | -0.00006067 | 0.00001843 | fixed |
| male | 0.0522 | 0.02569 | 2.032 | 0.001847 | 0.1026 | fixed |
| count_birth_order2/2 | -0.07531 | 0.06659 | -1.131 | -0.2058 | 0.05521 | fixed |
| count_birth_order1/3 | -0.04684 | 0.05752 | -0.8144 | -0.1596 | 0.06589 | fixed |
| count_birth_order2/3 | -0.1051 | 0.06241 | -1.683 | -0.2274 | 0.01726 | fixed |
| count_birth_order3/3 | -0.1749 | 0.07028 | -2.489 | -0.3127 | -0.03718 | fixed |
| count_birth_order1/4 | -0.04383 | 0.06804 | -0.6442 | -0.1772 | 0.08952 | fixed |
| count_birth_order2/4 | -0.09198 | 0.06936 | -1.326 | -0.2279 | 0.04397 | fixed |
| count_birth_order3/4 | -0.08984 | 0.07619 | -1.179 | -0.2392 | 0.0595 | fixed |
| count_birth_order4/4 | -0.1675 | 0.07856 | -2.132 | -0.3215 | -0.01353 | fixed |
| count_birth_order1/5 | -0.03052 | 0.08079 | -0.3778 | -0.1889 | 0.1278 | fixed |
| count_birth_order2/5 | -0.122 | 0.08684 | -1.404 | -0.2922 | 0.04824 | fixed |
| count_birth_order3/5 | -0.09178 | 0.08447 | -1.087 | -0.2573 | 0.07377 | fixed |
| count_birth_order4/5 | 0.002615 | 0.08758 | 0.02985 | -0.169 | 0.1743 | fixed |
| count_birth_order5/5 | -0.1843 | 0.08783 | -2.098 | -0.3564 | -0.01215 | fixed |
| count_birth_order1/5+ | -0.07646 | 0.07677 | -0.9959 | -0.2269 | 0.07402 | fixed |
| count_birth_order2/5+ | -0.0221 | 0.08027 | -0.2753 | -0.1794 | 0.1352 | fixed |
| count_birth_order3/5+ | -0.1136 | 0.07879 | -1.442 | -0.268 | 0.04081 | fixed |
| count_birth_order4/5+ | 0.01616 | 0.07584 | 0.2131 | -0.1325 | 0.1648 | fixed |
| count_birth_order5/5+ | 0.03516 | 0.07798 | 0.4509 | -0.1177 | 0.188 | fixed |
| count_birth_order5+/5+ | -0.06057 | 0.05661 | -1.07 | -0.1715 | 0.05038 | fixed |
| sd_(Intercept).mother_pidlink | 0.2173 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9672 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 16858 | 16931 | -8418 | 16836 | NA | NA | NA |
| 12 | 16859 | 16939 | -8417 | 16835 | 1.136 | 1 | 0.2865 |
| 16 | 16863 | 16970 | -8415 | 16831 | 3.922 | 4 | 0.4166 |
| 26 | 16873 | 17047 | -8411 | 16821 | 9.357 | 10 | 0.4986 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.7476 | 0.4452 | -1.679 | -1.62 | 0.1249 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.003025 | 0.05052 | 0.05987 | -0.096 | 0.102 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001617 | 0.001803 | 0.8969 | -0.001917 | 0.005151 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002573 | 0.00002042 | -1.26 | -0.00006575 | 0.00001429 | fixed |
| male | 0.05245 | 0.02602 | 2.016 | 0.001454 | 0.1035 | fixed |
| sibling_count3 | -0.06345 | 0.03902 | -1.626 | -0.1399 | 0.01303 | fixed |
| sibling_count4 | -0.05627 | 0.04207 | -1.338 | -0.1387 | 0.02618 | fixed |
| sibling_count5 | 0.01114 | 0.04923 | 0.2263 | -0.08535 | 0.1076 | fixed |
| sibling_count5+ | 0.04261 | 0.04251 | 1.002 | -0.0407 | 0.1259 | fixed |
| sd_(Intercept).mother_pidlink | 0.215 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9666 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.7362 | 0.4451 | -1.654 | -1.609 | 0.1362 | fixed |
| birth_order | -0.0169 | 0.008689 | -1.945 | -0.03393 | 0.0001265 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.003965 | 0.05051 | 0.07849 | -0.09504 | 0.103 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001616 | 0.001802 | 0.8963 | -0.001917 | 0.005148 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002637 | 0.00002042 | -1.292 | -0.00006639 | 0.00001365 | fixed |
| male | 0.05286 | 0.02601 | 2.032 | 0.001874 | 0.1038 | fixed |
| sibling_count3 | -0.0553 | 0.03924 | -1.409 | -0.1322 | 0.0216 | fixed |
| sibling_count4 | -0.03742 | 0.04316 | -0.8669 | -0.122 | 0.04718 | fixed |
| sibling_count5 | 0.04108 | 0.05157 | 0.7966 | -0.05999 | 0.1422 | fixed |
| sibling_count5+ | 0.1052 | 0.05331 | 1.974 | 0.0007359 | 0.2097 | fixed |
| sd_(Intercept).mother_pidlink | 0.2149 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9664 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.7235 | 0.4458 | -1.623 | -1.597 | 0.1503 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.001757 | 0.05055 | 0.03477 | -0.09731 | 0.1008 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001695 | 0.001804 | 0.9395 | -0.001841 | 0.00523 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002722 | 0.00002044 | -1.332 | -0.00006728 | 0.00001283 | fixed |
| male | 0.05268 | 0.02603 | 2.024 | 0.001673 | 0.1037 | fixed |
| sibling_count3 | -0.05402 | 0.04017 | -1.345 | -0.1328 | 0.0247 | fixed |
| sibling_count4 | -0.03311 | 0.04509 | -0.7342 | -0.1215 | 0.05527 | fixed |
| sibling_count5 | 0.04809 | 0.05423 | 0.8869 | -0.05819 | 0.1544 | fixed |
| sibling_count5+ | 0.1025 | 0.05516 | 1.858 | -0.005624 | 0.2106 | fixed |
| birth_order_nonlinear2 | -0.04874 | 0.03365 | -1.449 | -0.1147 | 0.01721 | fixed |
| birth_order_nonlinear3 | -0.0439 | 0.04152 | -1.057 | -0.1253 | 0.03749 | fixed |
| birth_order_nonlinear4 | -0.07397 | 0.05271 | -1.403 | -0.1773 | 0.02935 | fixed |
| birth_order_nonlinear5 | -0.09912 | 0.06679 | -1.484 | -0.23 | 0.03179 | fixed |
| birth_order_nonlinear5+ | -0.1016 | 0.06554 | -1.55 | -0.2301 | 0.02684 | fixed |
| sd_(Intercept).mother_pidlink | 0.2148 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9667 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.7227 | 0.4465 | -1.619 | -1.598 | 0.1524 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.004249 | 0.05062 | 0.08394 | -0.09497 | 0.1035 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001573 | 0.001807 | 0.8707 | -0.001968 | 0.005114 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002548 | 0.00002047 | -1.244 | -0.0000656 | 0.00001465 | fixed |
| male | 0.0537 | 0.02603 | 2.063 | 0.00269 | 0.1047 | fixed |
| count_birth_order2/2 | -0.09551 | 0.05926 | -1.612 | -0.2117 | 0.02064 | fixed |
| count_birth_order1/3 | -0.0317 | 0.05239 | -0.6052 | -0.1344 | 0.07098 | fixed |
| count_birth_order2/3 | -0.1419 | 0.05797 | -2.447 | -0.2555 | -0.02825 | fixed |
| count_birth_order3/3 | -0.1565 | 0.06373 | -2.456 | -0.2814 | -0.03161 | fixed |
| count_birth_order1/4 | -0.1047 | 0.0652 | -1.606 | -0.2325 | 0.02307 | fixed |
| count_birth_order2/4 | -0.03028 | 0.0671 | -0.4513 | -0.1618 | 0.1012 | fixed |
| count_birth_order3/4 | -0.01813 | 0.07034 | -0.2577 | -0.156 | 0.1197 | fixed |
| count_birth_order4/4 | -0.2182 | 0.07436 | -2.935 | -0.3639 | -0.07247 | fixed |
| count_birth_order1/5 | -0.08435 | 0.08798 | -0.9588 | -0.2568 | 0.08809 | fixed |
| count_birth_order2/5 | 0.0693 | 0.09733 | 0.712 | -0.1215 | 0.2601 | fixed |
| count_birth_order3/5 | 0.05283 | 0.09288 | 0.5688 | -0.1292 | 0.2349 | fixed |
| count_birth_order4/5 | -0.0298 | 0.08948 | -0.333 | -0.2052 | 0.1456 | fixed |
| count_birth_order5/5 | -0.08705 | 0.09509 | -0.9154 | -0.2734 | 0.09932 | fixed |
| count_birth_order1/5+ | 0.07337 | 0.08958 | 0.8191 | -0.1022 | 0.2489 | fixed |
| count_birth_order2/5+ | -0.01039 | 0.08886 | -0.1169 | -0.1845 | 0.1638 | fixed |
| count_birth_order3/5+ | -0.04537 | 0.08811 | -0.515 | -0.2181 | 0.1273 | fixed |
| count_birth_order4/5+ | 0.1355 | 0.08621 | 1.571 | -0.0335 | 0.3044 | fixed |
| count_birth_order5/5+ | 0.0005431 | 0.07922 | 0.006856 | -0.1547 | 0.1558 | fixed |
| count_birth_order5+/5+ | -0.01412 | 0.05865 | -0.2408 | -0.1291 | 0.1008 | fixed |
| sd_(Intercept).mother_pidlink | 0.2155 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9659 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 16366 | 16440 | -8172 | 16344 | NA | NA | NA |
| 12 | 16364 | 16444 | -8170 | 16340 | 3.79 | 1 | 0.05156 |
| 16 | 16372 | 16478 | -8170 | 16340 | 0.7968 | 4 | 0.9389 |
| 26 | 16375 | 16548 | -8161 | 16323 | 16.83 | 10 | 0.07811 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = big5_agree)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5625 | 0.1596 | -3.524 | -0.8753 | -0.2497 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0273 | 0.01529 | 1.786 | -0.002658 | 0.05726 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002583 | 0.0004491 | -0.5752 | -0.001139 | 0.0006219 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000008022 | 0.000004131 | -0.1942 | -0.000008898 | 0.000007294 | fixed |
| male | 0.06076 | 0.0169 | 3.596 | 0.02764 | 0.09387 | fixed |
| sibling_count3 | -0.02089 | 0.03345 | -0.6245 | -0.08646 | 0.04467 | fixed |
| sibling_count4 | 0.03056 | 0.03436 | 0.8896 | -0.03677 | 0.0979 | fixed |
| sibling_count5 | 0.007767 | 0.03558 | 0.2183 | -0.06196 | 0.0775 | fixed |
| sibling_count5+ | 0.005771 | 0.02805 | 0.2058 | -0.0492 | 0.06074 | fixed |
| sd_(Intercept).mother_pidlink | 0.2511 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9667 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5602 | 0.1596 | -3.509 | -0.873 | -0.2473 | fixed |
| birth_order | 0.004807 | 0.003507 | 1.371 | -0.002065 | 0.01168 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02588 | 0.01532 | 1.689 | -0.004146 | 0.05591 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002084 | 0.0004506 | -0.4624 | -0.001091 | 0.0006747 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001256 | 0.000004144 | -0.303 | -0.000009377 | 0.000006866 | fixed |
| male | 0.06062 | 0.0169 | 3.588 | 0.02751 | 0.09373 | fixed |
| sibling_count3 | -0.0221 | 0.03346 | -0.6604 | -0.08768 | 0.04349 | fixed |
| sibling_count4 | 0.02712 | 0.03445 | 0.7873 | -0.0404 | 0.09463 | fixed |
| sibling_count5 | 0.001865 | 0.03584 | 0.05204 | -0.06837 | 0.0721 | fixed |
| sibling_count5+ | -0.01264 | 0.03109 | -0.4065 | -0.07358 | 0.0483 | fixed |
| sd_(Intercept).mother_pidlink | 0.251 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9667 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5594 | 0.1601 | -3.495 | -0.8731 | -0.2457 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02613 | 0.01533 | 1.705 | -0.003906 | 0.05617 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002155 | 0.0004507 | -0.4782 | -0.001099 | 0.0006679 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001198 | 0.000004146 | -0.2889 | -0.000009323 | 0.000006927 | fixed |
| male | 0.0607 | 0.0169 | 3.592 | 0.02758 | 0.09382 | fixed |
| sibling_count3 | -0.01916 | 0.03398 | -0.5638 | -0.08576 | 0.04744 | fixed |
| sibling_count4 | 0.02892 | 0.03552 | 0.814 | -0.0407 | 0.09853 | fixed |
| sibling_count5 | 0.007183 | 0.03737 | 0.1922 | -0.06606 | 0.08043 | fixed |
| sibling_count5+ | -0.01117 | 0.03282 | -0.3404 | -0.0755 | 0.05315 | fixed |
| birth_order_nonlinear2 | 0.008944 | 0.0247 | 0.3622 | -0.03946 | 0.05735 | fixed |
| birth_order_nonlinear3 | -0.002557 | 0.02915 | -0.08772 | -0.0597 | 0.05458 | fixed |
| birth_order_nonlinear4 | 0.02067 | 0.0332 | 0.6226 | -0.0444 | 0.08574 | fixed |
| birth_order_nonlinear5 | -0.001727 | 0.03775 | -0.04573 | -0.07572 | 0.07227 | fixed |
| birth_order_nonlinear5+ | 0.04206 | 0.03104 | 1.355 | -0.01877 | 0.1029 | fixed |
| sd_(Intercept).mother_pidlink | 0.251 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9668 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5441 | 0.1607 | -3.384 | -0.8591 | -0.229 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0261 | 0.01533 | 1.703 | -0.003943 | 0.05615 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002053 | 0.0004508 | -0.4555 | -0.001089 | 0.0006782 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001373 | 0.000004146 | -0.331 | -0.0000095 | 0.000006754 | fixed |
| male | 0.06108 | 0.0169 | 3.615 | 0.02796 | 0.0942 | fixed |
| count_birth_order2/2 | -0.03887 | 0.048 | -0.8099 | -0.133 | 0.0552 | fixed |
| count_birth_order1/3 | -0.02833 | 0.04506 | -0.6288 | -0.1167 | 0.05999 | fixed |
| count_birth_order2/3 | 0.003943 | 0.05039 | 0.07825 | -0.09482 | 0.1027 | fixed |
| count_birth_order3/3 | -0.1023 | 0.05645 | -1.812 | -0.2129 | 0.008348 | fixed |
| count_birth_order1/4 | 0.0002992 | 0.05146 | 0.005815 | -0.1006 | 0.1012 | fixed |
| count_birth_order2/4 | 0.0164 | 0.05412 | 0.3031 | -0.08967 | 0.1225 | fixed |
| count_birth_order3/4 | -0.02745 | 0.05881 | -0.4668 | -0.1427 | 0.08781 | fixed |
| count_birth_order4/4 | 0.09601 | 0.06227 | 1.542 | -0.02603 | 0.218 | fixed |
| count_birth_order1/5 | 0.03871 | 0.0584 | 0.6629 | -0.07574 | 0.1532 | fixed |
| count_birth_order2/5 | -0.03562 | 0.06143 | -0.5797 | -0.156 | 0.08479 | fixed |
| count_birth_order3/5 | -0.03819 | 0.06306 | -0.6057 | -0.1618 | 0.0854 | fixed |
| count_birth_order4/5 | -0.01414 | 0.0668 | -0.2117 | -0.1451 | 0.1168 | fixed |
| count_birth_order5/5 | 0.01126 | 0.06829 | 0.1649 | -0.1226 | 0.1451 | fixed |
| count_birth_order1/5+ | -0.08303 | 0.04717 | -1.76 | -0.1755 | 0.009415 | fixed |
| count_birth_order2/5+ | -0.001421 | 0.04866 | -0.02921 | -0.09679 | 0.09394 | fixed |
| count_birth_order3/5+ | 0.03321 | 0.04767 | 0.6967 | -0.06022 | 0.1266 | fixed |
| count_birth_order4/5+ | -0.02795 | 0.04671 | -0.5984 | -0.1195 | 0.06361 | fixed |
| count_birth_order5/5+ | -0.03953 | 0.04706 | -0.8398 | -0.1318 | 0.05272 | fixed |
| count_birth_order5+/5+ | 0.0126 | 0.03651 | 0.3452 | -0.05896 | 0.08416 | fixed |
| sd_(Intercept).mother_pidlink | 0.2528 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9662 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 39479 | 39562 | -19728 | 39457 | NA | NA | NA |
| 12 | 39479 | 39569 | -19727 | 39455 | 1.881 | 1 | 0.1702 |
| 16 | 39486 | 39607 | -19727 | 39454 | 0.9485 | 4 | 0.9175 |
| 26 | 39492 | 39688 | -19720 | 39440 | 13.71 | 10 | 0.1865 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.645 | 0.4388 | -1.47 | -1.505 | 0.215 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.03354 | 0.04978 | 0.6737 | -0.06403 | 0.1311 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0003367 | 0.001776 | -0.1896 | -0.003818 | 0.003144 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000005582 | 0.00002011 | -0.02776 | -0.00003997 | 0.00003886 | fixed |
| male | 0.05795 | 0.02567 | 2.258 | 0.007642 | 0.1083 | fixed |
| sibling_count3 | -0.04282 | 0.03968 | -1.079 | -0.1206 | 0.03495 | fixed |
| sibling_count4 | -0.05145 | 0.04258 | -1.208 | -0.1349 | 0.032 | fixed |
| sibling_count5 | 0.007037 | 0.04843 | 0.1453 | -0.08788 | 0.102 | fixed |
| sibling_count5+ | -0.05468 | 0.04243 | -1.288 | -0.1378 | 0.02849 | fixed |
| sd_(Intercept).mother_pidlink | 0.2632 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9527 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.6472 | 0.4389 | -1.475 | -1.507 | 0.213 | fixed |
| birth_order | 0.002615 | 0.00843 | 0.3102 | -0.01391 | 0.01914 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.03343 | 0.04979 | 0.6715 | -0.06415 | 0.131 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0003375 | 0.001776 | -0.19 | -0.003819 | 0.003144 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000004477 | 0.00002011 | -0.02226 | -0.00003987 | 0.00003898 | fixed |
| male | 0.05784 | 0.02567 | 2.253 | 0.007523 | 0.1082 | fixed |
| sibling_count3 | -0.04408 | 0.03989 | -1.105 | -0.1223 | 0.0341 | fixed |
| sibling_count4 | -0.05442 | 0.04364 | -1.247 | -0.14 | 0.03112 | fixed |
| sibling_count5 | 0.002162 | 0.05092 | 0.04246 | -0.09764 | 0.102 | fixed |
| sibling_count5+ | -0.06446 | 0.05288 | -1.219 | -0.1681 | 0.03918 | fixed |
| sd_(Intercept).mother_pidlink | 0.2632 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9528 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.6237 | 0.4395 | -1.419 | -1.485 | 0.2378 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.03241 | 0.04982 | 0.6507 | -0.06522 | 0.1301 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002935 | 0.001777 | -0.1651 | -0.003777 | 0.00319 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001054 | 0.00002013 | -0.05235 | -0.00004051 | 0.0000384 | fixed |
| male | 0.05752 | 0.02568 | 2.24 | 0.007194 | 0.1078 | fixed |
| sibling_count3 | -0.03331 | 0.04077 | -0.8171 | -0.1132 | 0.04659 | fixed |
| sibling_count4 | -0.05023 | 0.04547 | -1.105 | -0.1394 | 0.03889 | fixed |
| sibling_count5 | -0.003593 | 0.05371 | -0.06689 | -0.1089 | 0.1017 | fixed |
| sibling_count5+ | -0.05582 | 0.05457 | -1.023 | -0.1628 | 0.05114 | fixed |
| birth_order_nonlinear2 | -0.03669 | 0.03347 | -1.096 | -0.1023 | 0.02892 | fixed |
| birth_order_nonlinear3 | -0.04412 | 0.04123 | -1.07 | -0.1249 | 0.03668 | fixed |
| birth_order_nonlinear4 | 0.02951 | 0.05091 | 0.5796 | -0.07027 | 0.1293 | fixed |
| birth_order_nonlinear5 | 0.03323 | 0.06362 | 0.5224 | -0.09146 | 0.1579 | fixed |
| birth_order_nonlinear5+ | -0.03071 | 0.06333 | -0.485 | -0.1548 | 0.0934 | fixed |
| sd_(Intercept).mother_pidlink | 0.263 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9529 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.6322 | 0.4405 | -1.435 | -1.496 | 0.2312 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.03344 | 0.04993 | 0.6699 | -0.06441 | 0.1313 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0003295 | 0.001782 | -0.1849 | -0.003822 | 0.003163 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000006666 | 0.00002018 | -0.03303 | -0.00004022 | 0.00003889 | fixed |
| male | 0.05848 | 0.0257 | 2.276 | 0.008111 | 0.1089 | fixed |
| count_birth_order2/2 | -0.03959 | 0.06047 | -0.6547 | -0.1581 | 0.07893 | fixed |
| count_birth_order1/3 | -0.02909 | 0.05298 | -0.5491 | -0.1329 | 0.07474 | fixed |
| count_birth_order2/3 | -0.05869 | 0.05791 | -1.014 | -0.1722 | 0.0548 | fixed |
| count_birth_order3/3 | -0.1059 | 0.06475 | -1.636 | -0.2328 | 0.021 | fixed |
| count_birth_order1/4 | -0.06212 | 0.06478 | -0.9589 | -0.1891 | 0.06485 | fixed |
| count_birth_order2/4 | -0.1076 | 0.06708 | -1.603 | -0.239 | 0.02392 | fixed |
| count_birth_order3/4 | -0.0601 | 0.07093 | -0.8474 | -0.1991 | 0.07891 | fixed |
| count_birth_order4/4 | -0.0189 | 0.07374 | -0.2563 | -0.1634 | 0.1256 | fixed |
| count_birth_order1/5 | 0.04298 | 0.08804 | 0.4882 | -0.1296 | 0.2155 | fixed |
| count_birth_order2/5 | -0.101 | 0.09431 | -1.071 | -0.2858 | 0.08387 | fixed |
| count_birth_order3/5 | -0.02089 | 0.08841 | -0.2363 | -0.1942 | 0.1524 | fixed |
| count_birth_order4/5 | -0.05274 | 0.08515 | -0.6193 | -0.2196 | 0.1142 | fixed |
| count_birth_order5/5 | 0.08936 | 0.08862 | 1.008 | -0.08434 | 0.2631 | fixed |
| count_birth_order1/5+ | -0.1027 | 0.08735 | -1.176 | -0.2739 | 0.06853 | fixed |
| count_birth_order2/5+ | -0.0403 | 0.08651 | -0.4659 | -0.2099 | 0.1292 | fixed |
| count_birth_order3/5+ | -0.1274 | 0.08669 | -1.47 | -0.2973 | 0.04252 | fixed |
| count_birth_order4/5+ | 0.03782 | 0.08169 | 0.463 | -0.1223 | 0.1979 | fixed |
| count_birth_order5/5+ | -0.0659 | 0.0772 | -0.8536 | -0.2172 | 0.08541 | fixed |
| count_birth_order5+/5+ | -0.08752 | 0.05776 | -1.515 | -0.2007 | 0.02568 | fixed |
| sd_(Intercept).mother_pidlink | 0.2633 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9531 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 16672 | 16745 | -8325 | 16650 | NA | NA | NA |
| 12 | 16673 | 16754 | -8325 | 16649 | 0.09659 | 1 | 0.756 |
| 16 | 16677 | 16784 | -8323 | 16645 | 3.955 | 4 | 0.4121 |
| 26 | 16692 | 16866 | -8320 | 16640 | 5.719 | 10 | 0.8383 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.6188 | 0.4369 | -1.416 | -1.475 | 0.2376 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.03119 | 0.04959 | 0.629 | -0.06601 | 0.1284 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002451 | 0.00177 | -0.1385 | -0.003714 | 0.003224 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001585 | 0.00002004 | -0.07908 | -0.00004086 | 0.00003769 | fixed |
| male | 0.05768 | 0.02554 | 2.259 | 0.007634 | 0.1077 | fixed |
| sibling_count3 | -0.05156 | 0.04288 | -1.202 | -0.1356 | 0.03248 | fixed |
| sibling_count4 | -0.02386 | 0.04507 | -0.5294 | -0.1122 | 0.06447 | fixed |
| sibling_count5 | -0.03461 | 0.04805 | -0.7203 | -0.1288 | 0.05956 | fixed |
| sibling_count5+ | -0.0736 | 0.04215 | -1.746 | -0.1562 | 0.009005 | fixed |
| sd_(Intercept).mother_pidlink | 0.2616 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.952 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.6268 | 0.437 | -1.434 | -1.483 | 0.2296 | fixed |
| birth_order | 0.007124 | 0.007328 | 0.9722 | -0.007238 | 0.02149 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.03115 | 0.04959 | 0.6282 | -0.06605 | 0.1283 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002563 | 0.00177 | -0.1448 | -0.003725 | 0.003212 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001183 | 0.00002005 | -0.05902 | -0.00004047 | 0.0000381 | fixed |
| male | 0.05745 | 0.02554 | 2.249 | 0.007393 | 0.1075 | fixed |
| sibling_count3 | -0.05498 | 0.04302 | -1.278 | -0.1393 | 0.02934 | fixed |
| sibling_count4 | -0.03161 | 0.04577 | -0.6907 | -0.1213 | 0.05809 | fixed |
| sibling_count5 | -0.04685 | 0.04967 | -0.9433 | -0.1442 | 0.0505 | fixed |
| sibling_count5+ | -0.0996 | 0.04991 | -1.995 | -0.1974 | -0.001771 | fixed |
| sd_(Intercept).mother_pidlink | 0.2614 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9521 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.6006 | 0.4376 | -1.373 | -1.458 | 0.2571 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.03018 | 0.04962 | 0.6083 | -0.06707 | 0.1274 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002201 | 0.001771 | -0.1243 | -0.003691 | 0.003251 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001571 | 0.00002006 | -0.07831 | -0.00004089 | 0.00003775 | fixed |
| male | 0.05734 | 0.02555 | 2.244 | 0.007266 | 0.1074 | fixed |
| sibling_count3 | -0.04586 | 0.04386 | -1.046 | -0.1318 | 0.0401 | fixed |
| sibling_count4 | -0.0244 | 0.04748 | -0.5138 | -0.1175 | 0.06867 | fixed |
| sibling_count5 | -0.04551 | 0.05221 | -0.8717 | -0.1478 | 0.05682 | fixed |
| sibling_count5+ | -0.1009 | 0.05158 | -1.957 | -0.202 | 0.0001439 | fixed |
| birth_order_nonlinear2 | -0.02657 | 0.03404 | -0.7807 | -0.09328 | 0.04014 | fixed |
| birth_order_nonlinear3 | -0.02837 | 0.04103 | -0.6913 | -0.1088 | 0.05206 | fixed |
| birth_order_nonlinear4 | 0.01991 | 0.04932 | 0.4036 | -0.07676 | 0.1166 | fixed |
| birth_order_nonlinear5 | 0.04047 | 0.06051 | 0.6688 | -0.07813 | 0.1591 | fixed |
| birth_order_nonlinear5+ | 0.04104 | 0.05641 | 0.7276 | -0.06952 | 0.1516 | fixed |
| sd_(Intercept).mother_pidlink | 0.2608 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9524 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.6018 | 0.4385 | -1.372 | -1.461 | 0.2578 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.03204 | 0.04971 | 0.6445 | -0.06539 | 0.1295 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002896 | 0.001775 | -0.1632 | -0.003768 | 0.003189 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000007273 | 0.0000201 | -0.03618 | -0.00004013 | 0.00003868 | fixed |
| male | 0.05762 | 0.02557 | 2.253 | 0.007493 | 0.1077 | fixed |
| count_birth_order2/2 | -0.07001 | 0.0661 | -1.059 | -0.1996 | 0.05955 | fixed |
| count_birth_order1/3 | -0.05588 | 0.05731 | -0.9752 | -0.1682 | 0.05643 | fixed |
| count_birth_order2/3 | -0.06772 | 0.06217 | -1.089 | -0.1896 | 0.05414 | fixed |
| count_birth_order3/3 | -0.127 | 0.07 | -1.814 | -0.2642 | 0.0102 | fixed |
| count_birth_order1/4 | -0.05227 | 0.06778 | -0.7711 | -0.1851 | 0.08058 | fixed |
| count_birth_order2/4 | -0.04976 | 0.06909 | -0.7201 | -0.1852 | 0.08567 | fixed |
| count_birth_order3/4 | -0.07543 | 0.07588 | -0.9941 | -0.2241 | 0.07329 | fixed |
| count_birth_order4/4 | -0.01413 | 0.07823 | -0.1806 | -0.1675 | 0.1392 | fixed |
| count_birth_order1/5 | -0.03582 | 0.08047 | -0.4451 | -0.1935 | 0.1219 | fixed |
| count_birth_order2/5 | -0.1593 | 0.08648 | -1.842 | -0.3288 | 0.01021 | fixed |
| count_birth_order3/5 | -0.03115 | 0.08411 | -0.3704 | -0.196 | 0.1337 | fixed |
| count_birth_order4/5 | -0.06292 | 0.0872 | -0.7215 | -0.2338 | 0.108 | fixed |
| count_birth_order5/5 | -0.0179 | 0.08745 | -0.2047 | -0.1893 | 0.1535 | fixed |
| count_birth_order1/5+ | -0.1703 | 0.07649 | -2.227 | -0.3203 | -0.02043 | fixed |
| count_birth_order2/5+ | -0.1037 | 0.07995 | -1.297 | -0.2604 | 0.05303 | fixed |
| count_birth_order3/5+ | -0.1335 | 0.07845 | -1.701 | -0.2873 | 0.02028 | fixed |
| count_birth_order4/5+ | -0.08556 | 0.07552 | -1.133 | -0.2336 | 0.06246 | fixed |
| count_birth_order5/5+ | -0.07678 | 0.07763 | -0.989 | -0.2289 | 0.07538 | fixed |
| count_birth_order5+/5+ | -0.07471 | 0.05656 | -1.321 | -0.1856 | 0.03614 | fixed |
| sd_(Intercept).mother_pidlink | 0.2602 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9531 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 16802 | 16876 | -8390 | 16780 | NA | NA | NA |
| 12 | 16803 | 16884 | -8390 | 16779 | 0.9475 | 1 | 0.3304 |
| 16 | 16810 | 16917 | -8389 | 16778 | 1.889 | 4 | 0.7562 |
| 26 | 16825 | 17000 | -8387 | 16773 | 4.132 | 10 | 0.9412 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5969 | 0.4431 | -1.347 | -1.465 | 0.2716 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02716 | 0.0503 | 0.5399 | -0.07142 | 0.1257 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00008155 | 0.001795 | -0.04543 | -0.0036 | 0.003437 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000003671 | 0.00002033 | -0.1805 | -0.00004353 | 0.00003618 | fixed |
| male | 0.0572 | 0.02589 | 2.21 | 0.00646 | 0.1079 | fixed |
| sibling_count3 | -0.04753 | 0.03907 | -1.217 | -0.1241 | 0.02904 | fixed |
| sibling_count4 | -0.06009 | 0.04218 | -1.425 | -0.1428 | 0.02258 | fixed |
| sibling_count5 | 0.04759 | 0.04945 | 0.9624 | -0.04933 | 0.1445 | fixed |
| sibling_count5+ | -0.0633 | 0.04274 | -1.481 | -0.1471 | 0.02047 | fixed |
| sd_(Intercept).mother_pidlink | 0.2586 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9519 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5982 | 0.4432 | -1.35 | -1.467 | 0.2704 | fixed |
| birth_order | 0.001925 | 0.008673 | 0.222 | -0.01507 | 0.01892 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02705 | 0.0503 | 0.5377 | -0.07154 | 0.1256 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00008128 | 0.001795 | -0.04528 | -0.0036 | 0.003437 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000003598 | 0.00002034 | -0.1769 | -0.00004346 | 0.00003627 | fixed |
| male | 0.05715 | 0.02589 | 2.207 | 0.006407 | 0.1079 | fixed |
| sibling_count3 | -0.04846 | 0.03929 | -1.233 | -0.1255 | 0.02856 | fixed |
| sibling_count4 | -0.06225 | 0.04329 | -1.438 | -0.1471 | 0.0226 | fixed |
| sibling_count5 | 0.04417 | 0.05181 | 0.8525 | -0.05738 | 0.1457 | fixed |
| sibling_count5+ | -0.07045 | 0.05352 | -1.316 | -0.1753 | 0.03444 | fixed |
| sd_(Intercept).mother_pidlink | 0.2587 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9519 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5775 | 0.4438 | -1.301 | -1.447 | 0.2924 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02592 | 0.05033 | 0.515 | -0.07272 | 0.1246 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00003914 | 0.001796 | -0.02179 | -0.00356 | 0.003481 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000004064 | 0.00002035 | -0.1997 | -0.00004396 | 0.00003583 | fixed |
| male | 0.0566 | 0.0259 | 2.186 | 0.005845 | 0.1074 | fixed |
| sibling_count3 | -0.03684 | 0.0402 | -0.9166 | -0.1156 | 0.04194 | fixed |
| sibling_count4 | -0.05666 | 0.04517 | -1.254 | -0.1452 | 0.03188 | fixed |
| sibling_count5 | 0.04475 | 0.0544 | 0.8225 | -0.06188 | 0.1514 | fixed |
| sibling_count5+ | -0.06844 | 0.05532 | -1.237 | -0.1769 | 0.03998 | fixed |
| birth_order_nonlinear2 | -0.02562 | 0.03336 | -0.768 | -0.09101 | 0.03976 | fixed |
| birth_order_nonlinear3 | -0.04947 | 0.0412 | -1.201 | -0.1302 | 0.03128 | fixed |
| birth_order_nonlinear4 | 0.0286 | 0.05233 | 0.5465 | -0.07397 | 0.1312 | fixed |
| birth_order_nonlinear5 | 0.007749 | 0.06629 | 0.1169 | -0.1222 | 0.1377 | fixed |
| birth_order_nonlinear5+ | -0.00116 | 0.06527 | -0.01777 | -0.1291 | 0.1268 | fixed |
| sd_(Intercept).mother_pidlink | 0.2588 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.952 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5521 | 0.4449 | -1.241 | -1.424 | 0.3198 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02312 | 0.05045 | 0.4584 | -0.07575 | 0.122 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00006625 | 0.001801 | 0.03679 | -0.003463 | 0.003596 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000005314 | 0.00002041 | -0.2604 | -0.00004531 | 0.00003468 | fixed |
| male | 0.05695 | 0.02592 | 2.197 | 0.006146 | 0.1078 | fixed |
| count_birth_order2/2 | -0.03262 | 0.05883 | -0.5544 | -0.1479 | 0.08269 | fixed |
| count_birth_order1/3 | -0.03163 | 0.05223 | -0.6057 | -0.134 | 0.07073 | fixed |
| count_birth_order2/3 | -0.05113 | 0.05778 | -0.885 | -0.1644 | 0.06211 | fixed |
| count_birth_order3/3 | -0.1218 | 0.0635 | -1.918 | -0.2462 | 0.002663 | fixed |
| count_birth_order1/4 | -0.07897 | 0.06499 | -1.215 | -0.2063 | 0.0484 | fixed |
| count_birth_order2/4 | -0.1058 | 0.06687 | -1.583 | -0.2369 | 0.02521 | fixed |
| count_birth_order3/4 | -0.07093 | 0.07008 | -1.012 | -0.2083 | 0.06642 | fixed |
| count_birth_order4/4 | -0.01687 | 0.07408 | -0.2277 | -0.1621 | 0.1283 | fixed |
| count_birth_order1/5 | 0.05054 | 0.08768 | 0.5764 | -0.1213 | 0.2224 | fixed |
| count_birth_order2/5 | -0.01504 | 0.09697 | -0.1551 | -0.2051 | 0.175 | fixed |
| count_birth_order3/5 | -0.0003237 | 0.09252 | -0.003499 | -0.1817 | 0.181 | fixed |
| count_birth_order4/5 | -0.02 | 0.08914 | -0.2244 | -0.1947 | 0.1547 | fixed |
| count_birth_order5/5 | 0.1681 | 0.09472 | 1.774 | -0.0176 | 0.3537 | fixed |
| count_birth_order1/5+ | -0.0804 | 0.08927 | -0.9006 | -0.2554 | 0.09458 | fixed |
| count_birth_order2/5+ | -0.05915 | 0.08855 | -0.668 | -0.2327 | 0.1144 | fixed |
| count_birth_order3/5+ | -0.1176 | 0.08777 | -1.34 | -0.2897 | 0.0544 | fixed |
| count_birth_order4/5+ | 0.02036 | 0.08587 | 0.2372 | -0.1479 | 0.1887 | fixed |
| count_birth_order5/5+ | -0.1374 | 0.07891 | -1.741 | -0.2921 | 0.01728 | fixed |
| count_birth_order5+/5+ | -0.07222 | 0.05867 | -1.231 | -0.1872 | 0.04277 | fixed |
| sd_(Intercept).mother_pidlink | 0.2592 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9522 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 16314 | 16387 | -8146 | 16292 | NA | NA | NA |
| 12 | 16316 | 16396 | -8146 | 16292 | 0.0492 | 1 | 0.8245 |
| 16 | 16321 | 16428 | -8144 | 16289 | 2.826 | 4 | 0.5874 |
| 26 | 16334 | 16508 | -8141 | 16282 | 6.65 | 10 | 0.758 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = big5_open)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.4167 | 0.1589 | 2.623 | 0.1053 | 0.728 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.03942 | 0.01522 | -2.59 | -0.06925 | -0.009592 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001142 | 0.0004473 | 2.552 | 0.0002649 | 0.002018 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001113 | 0.000004115 | -2.705 | -0.0000192 | -0.000003067 | fixed |
| male | 0.1705 | 0.01678 | 10.16 | 0.1377 | 0.2034 | fixed |
| sibling_count3 | -0.0164 | 0.03344 | -0.4905 | -0.08194 | 0.04913 | fixed |
| sibling_count4 | -0.04541 | 0.03438 | -1.321 | -0.1128 | 0.02197 | fixed |
| sibling_count5 | -0.004679 | 0.03564 | -0.1313 | -0.07454 | 0.06518 | fixed |
| sibling_count5+ | -0.07108 | 0.02806 | -2.533 | -0.1261 | -0.01608 | fixed |
| sd_(Intercept).mother_pidlink | 0.2818 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9529 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.4136 | 0.1588 | 2.604 | 0.1023 | 0.7249 | fixed |
| birth_order | -0.006737 | 0.003501 | -1.924 | -0.0136 | 0.0001249 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.03742 | 0.01525 | -2.453 | -0.06731 | -0.007525 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001071 | 0.0004488 | 2.386 | 0.000191 | 0.00195 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001049 | 0.000004129 | -2.54 | -0.00001858 | -0.000002394 | fixed |
| male | 0.1707 | 0.01678 | 10.18 | 0.1378 | 0.2036 | fixed |
| sibling_count3 | -0.01476 | 0.03344 | -0.4413 | -0.0803 | 0.05079 | fixed |
| sibling_count4 | -0.04063 | 0.03446 | -1.179 | -0.1082 | 0.02691 | fixed |
| sibling_count5 | 0.003553 | 0.03589 | 0.099 | -0.06679 | 0.0739 | fixed |
| sibling_count5+ | -0.04537 | 0.03107 | -1.46 | -0.1063 | 0.01553 | fixed |
| sd_(Intercept).mother_pidlink | 0.2814 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9529 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.4067 | 0.1593 | 2.554 | 0.09454 | 0.7189 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.03765 | 0.01526 | -2.467 | -0.06755 | -0.007742 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001092 | 0.0004489 | 2.432 | 0.0002121 | 0.001972 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001079 | 0.00000413 | -2.613 | -0.00001889 | -0.000002696 | fixed |
| male | 0.1708 | 0.01678 | 10.18 | 0.1379 | 0.2036 | fixed |
| sibling_count3 | -0.004799 | 0.03395 | -0.1414 | -0.07133 | 0.06173 | fixed |
| sibling_count4 | -0.02479 | 0.0355 | -0.6983 | -0.09438 | 0.04479 | fixed |
| sibling_count5 | 0.01456 | 0.03739 | 0.3894 | -0.05872 | 0.08783 | fixed |
| sibling_count5+ | -0.04095 | 0.03276 | -1.25 | -0.1051 | 0.02325 | fixed |
| birth_order_nonlinear2 | -0.01379 | 0.02447 | -0.5636 | -0.06176 | 0.03417 | fixed |
| birth_order_nonlinear3 | -0.0592 | 0.02888 | -2.049 | -0.1158 | -0.002584 | fixed |
| birth_order_nonlinear4 | -0.05691 | 0.0329 | -1.73 | -0.1214 | 0.007566 | fixed |
| birth_order_nonlinear5 | -0.007878 | 0.03741 | -0.2106 | -0.08121 | 0.06545 | fixed |
| birth_order_nonlinear5+ | -0.04945 | 0.03085 | -1.603 | -0.1099 | 0.01101 | fixed |
| sd_(Intercept).mother_pidlink | 0.2817 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9528 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.4334 | 0.16 | 2.709 | 0.1198 | 0.7469 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.03779 | 0.01526 | -2.477 | -0.0677 | -0.007886 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001099 | 0.0004489 | 2.448 | 0.000219 | 0.001979 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001087 | 0.000004131 | -2.633 | -0.00001897 | -0.000002778 | fixed |
| male | 0.1706 | 0.01678 | 10.16 | 0.1377 | 0.2034 | fixed |
| count_birth_order2/2 | -0.08334 | 0.04757 | -1.752 | -0.1766 | 0.009892 | fixed |
| count_birth_order1/3 | -0.0571 | 0.04482 | -1.274 | -0.1449 | 0.03074 | fixed |
| count_birth_order2/3 | -0.02348 | 0.05011 | -0.4685 | -0.1217 | 0.07474 | fixed |
| count_birth_order3/3 | -0.0652 | 0.05612 | -1.162 | -0.1752 | 0.0448 | fixed |
| count_birth_order1/4 | -0.07077 | 0.05117 | -1.383 | -0.1711 | 0.02953 | fixed |
| count_birth_order2/4 | -0.009176 | 0.05382 | -0.1705 | -0.1147 | 0.0963 | fixed |
| count_birth_order3/4 | -0.1791 | 0.05847 | -3.062 | -0.2936 | -0.06445 | fixed |
| count_birth_order4/4 | -0.07479 | 0.0619 | -1.208 | -0.1961 | 0.04654 | fixed |
| count_birth_order1/5 | 0.0005729 | 0.05806 | 0.009867 | -0.1132 | 0.1144 | fixed |
| count_birth_order2/5 | -0.06346 | 0.06107 | -1.039 | -0.1832 | 0.05625 | fixed |
| count_birth_order3/5 | -0.07172 | 0.06269 | -1.144 | -0.1946 | 0.05114 | fixed |
| count_birth_order4/5 | -0.02146 | 0.0664 | -0.3232 | -0.1516 | 0.1087 | fixed |
| count_birth_order5/5 | -0.03514 | 0.06788 | -0.5177 | -0.1682 | 0.09789 | fixed |
| count_birth_order1/5+ | -0.06634 | 0.04689 | -1.415 | -0.1582 | 0.02555 | fixed |
| count_birth_order2/5+ | -0.07713 | 0.04836 | -1.595 | -0.1719 | 0.01766 | fixed |
| count_birth_order3/5+ | -0.1038 | 0.04738 | -2.19 | -0.1966 | -0.01091 | fixed |
| count_birth_order4/5+ | -0.1541 | 0.04643 | -3.319 | -0.2451 | -0.06311 | fixed |
| count_birth_order5/5+ | -0.06927 | 0.04678 | -1.481 | -0.161 | 0.02241 | fixed |
| count_birth_order5+/5+ | -0.1164 | 0.0364 | -3.198 | -0.1877 | -0.04506 | fixed |
| sd_(Intercept).mother_pidlink | 0.2812 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.953 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 39311 | 39394 | -19645 | 39289 | NA | NA | NA |
| 12 | 39310 | 39400 | -19643 | 39286 | 3.706 | 1 | 0.05421 |
| 16 | 39315 | 39435 | -19641 | 39283 | 3.124 | 4 | 0.5373 |
| 26 | 39324 | 39521 | -19636 | 39272 | 10.07 | 10 | 0.4341 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.833 | 0.4144 | -2.01 | -1.645 | -0.02067 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1105 | 0.04703 | 2.349 | 0.0183 | 0.2026 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.004051 | 0.001678 | -2.414 | -0.00734 | -0.0007618 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004751 | 0.000019 | 2.5 | 0.00001026 | 0.00008475 | fixed |
| male | 0.1386 | 0.02423 | 5.719 | 0.09108 | 0.1861 | fixed |
| sibling_count3 | -0.09714 | 0.03779 | -2.571 | -0.1712 | -0.02308 | fixed |
| sibling_count4 | -0.08943 | 0.04063 | -2.201 | -0.1691 | -0.009798 | fixed |
| sibling_count5 | -0.1136 | 0.04629 | -2.453 | -0.2043 | -0.02283 | fixed |
| sibling_count5+ | -0.1441 | 0.04061 | -3.548 | -0.2237 | -0.06447 | fixed |
| sd_(Intercept).mother_pidlink | 0.2961 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8871 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8361 | 0.4145 | -2.017 | -1.649 | -0.02365 | fixed |
| birth_order | 0.003801 | 0.007987 | 0.4758 | -0.01185 | 0.01946 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1103 | 0.04703 | 2.345 | 0.01813 | 0.2025 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.004051 | 0.001678 | -2.414 | -0.007341 | -0.0007619 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004766 | 0.00001901 | 2.507 | 0.00001041 | 0.00008491 | fixed |
| male | 0.1384 | 0.02423 | 5.711 | 0.0909 | 0.1859 | fixed |
| sibling_count3 | -0.09898 | 0.03799 | -2.606 | -0.1734 | -0.02453 | fixed |
| sibling_count4 | -0.09377 | 0.04164 | -2.252 | -0.1754 | -0.01216 | fixed |
| sibling_count5 | -0.1207 | 0.04866 | -2.481 | -0.2161 | -0.02533 | fixed |
| sibling_count5+ | -0.1583 | 0.0505 | -3.136 | -0.2573 | -0.05937 | fixed |
| sd_(Intercept).mother_pidlink | 0.296 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8872 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8633 | 0.4151 | -2.08 | -1.677 | -0.04975 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.113 | 0.04705 | 2.402 | 0.02079 | 0.2052 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00414 | 0.001679 | -2.466 | -0.007431 | -0.0008496 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000485 | 0.00001902 | 2.55 | 0.00001123 | 0.00008577 | fixed |
| male | 0.1388 | 0.02423 | 5.727 | 0.09127 | 0.1862 | fixed |
| sibling_count3 | -0.0928 | 0.03879 | -2.392 | -0.1688 | -0.01678 | fixed |
| sibling_count4 | -0.09456 | 0.04332 | -2.183 | -0.1795 | -0.009643 | fixed |
| sibling_count5 | -0.1389 | 0.05122 | -2.712 | -0.2393 | -0.03852 | fixed |
| sibling_count5+ | -0.146 | 0.05205 | -2.806 | -0.248 | -0.04402 | fixed |
| birth_order_nonlinear2 | 0.02394 | 0.03144 | 0.7614 | -0.03769 | 0.08556 | fixed |
| birth_order_nonlinear3 | -0.01775 | 0.03877 | -0.4578 | -0.09373 | 0.05823 | fixed |
| birth_order_nonlinear4 | 0.05292 | 0.0479 | 1.105 | -0.04096 | 0.1468 | fixed |
| birth_order_nonlinear5 | 0.106 | 0.05983 | 1.771 | -0.01128 | 0.2233 | fixed |
| birth_order_nonlinear5+ | -0.03825 | 0.05984 | -0.6391 | -0.1555 | 0.07904 | fixed |
| sd_(Intercept).mother_pidlink | 0.2962 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8869 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8675 | 0.416 | -2.085 | -1.683 | -0.05216 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1149 | 0.04715 | 2.436 | 0.02247 | 0.2073 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.004197 | 0.001683 | -2.494 | -0.007495 | -0.0008982 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004901 | 0.00001906 | 2.571 | 0.00001164 | 0.00008637 | fixed |
| male | 0.1395 | 0.02425 | 5.752 | 0.09196 | 0.187 | fixed |
| count_birth_order2/2 | -0.01995 | 0.05685 | -0.351 | -0.1314 | 0.09147 | fixed |
| count_birth_order1/3 | -0.137 | 0.05008 | -2.736 | -0.2352 | -0.03889 | fixed |
| count_birth_order2/3 | -0.07656 | 0.05472 | -1.399 | -0.1838 | 0.03069 | fixed |
| count_birth_order3/3 | -0.0773 | 0.06117 | -1.264 | -0.1972 | 0.04259 | fixed |
| count_birth_order1/4 | -0.07394 | 0.06123 | -1.208 | -0.194 | 0.04607 | fixed |
| count_birth_order2/4 | -0.1317 | 0.06338 | -2.078 | -0.2559 | -0.007483 | fixed |
| count_birth_order3/4 | -0.1464 | 0.06698 | -2.186 | -0.2777 | -0.01516 | fixed |
| count_birth_order4/4 | -0.02691 | 0.06964 | -0.3864 | -0.1634 | 0.1096 | fixed |
| count_birth_order1/5 | -0.1685 | 0.08317 | -2.026 | -0.3315 | -0.005496 | fixed |
| count_birth_order2/5 | -0.05147 | 0.08905 | -0.578 | -0.226 | 0.1231 | fixed |
| count_birth_order3/5 | -0.2027 | 0.08347 | -2.428 | -0.3663 | -0.03908 | fixed |
| count_birth_order4/5 | -0.1164 | 0.08041 | -1.448 | -0.274 | 0.04115 | fixed |
| count_birth_order5/5 | -0.05156 | 0.08367 | -0.6162 | -0.2156 | 0.1124 | fixed |
| count_birth_order1/5+ | -0.1743 | 0.08252 | -2.112 | -0.336 | -0.01253 | fixed |
| count_birth_order2/5+ | -0.06251 | 0.0817 | -0.7651 | -0.2226 | 0.09762 | fixed |
| count_birth_order3/5+ | -0.2153 | 0.08185 | -2.631 | -0.3757 | -0.05489 | fixed |
| count_birth_order4/5+ | -0.1316 | 0.07712 | -1.707 | -0.2828 | 0.01951 | fixed |
| count_birth_order5/5+ | -0.0526 | 0.07288 | -0.7217 | -0.1954 | 0.09024 | fixed |
| count_birth_order5+/5+ | -0.1993 | 0.05481 | -3.636 | -0.3067 | -0.09185 | fixed |
| sd_(Intercept).mother_pidlink | 0.2959 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8872 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 16002 | 16076 | -7990 | 15980 | NA | NA | NA |
| 12 | 16004 | 16084 | -7990 | 15980 | 0.2274 | 1 | 0.6335 |
| 16 | 16005 | 16112 | -7986 | 15973 | 7.314 | 4 | 0.1202 |
| 26 | 16018 | 16192 | -7983 | 15966 | 6.635 | 10 | 0.7594 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.7636 | 0.4132 | -1.848 | -1.573 | 0.04634 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1043 | 0.04691 | 2.224 | 0.01237 | 0.1963 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003837 | 0.001674 | -2.292 | -0.007119 | -0.0005553 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004507 | 0.00001896 | 2.376 | 0.000007898 | 0.00008223 | fixed |
| male | 0.1403 | 0.02414 | 5.814 | 0.09303 | 0.1876 | fixed |
| sibling_count3 | -0.1248 | 0.04088 | -3.052 | -0.2049 | -0.04466 | fixed |
| sibling_count4 | -0.1013 | 0.04303 | -2.354 | -0.1856 | -0.01694 | fixed |
| sibling_count5 | -0.1191 | 0.04596 | -2.592 | -0.2092 | -0.02906 | fixed |
| sibling_count5+ | -0.134 | 0.0403 | -3.325 | -0.213 | -0.055 | fixed |
| sd_(Intercept).mother_pidlink | 0.2966 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8872 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.7645 | 0.4133 | -1.85 | -1.575 | 0.04561 | fixed |
| birth_order | 0.0008314 | 0.006965 | 0.1194 | -0.01282 | 0.01448 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1043 | 0.04691 | 2.223 | 0.01236 | 0.1963 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003838 | 0.001674 | -2.292 | -0.00712 | -0.0005563 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004511 | 0.00001897 | 2.378 | 0.000007934 | 0.00008229 | fixed |
| male | 0.1403 | 0.02414 | 5.812 | 0.09299 | 0.1876 | fixed |
| sibling_count3 | -0.1252 | 0.04102 | -3.052 | -0.2056 | -0.04478 | fixed |
| sibling_count4 | -0.1022 | 0.04371 | -2.338 | -0.1879 | -0.01652 | fixed |
| sibling_count5 | -0.1206 | 0.04751 | -2.538 | -0.2137 | -0.02745 | fixed |
| sibling_count5+ | -0.137 | 0.04768 | -2.874 | -0.2305 | -0.04357 | fixed |
| sd_(Intercept).mother_pidlink | 0.2967 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8873 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.7658 | 0.4139 | -1.85 | -1.577 | 0.04536 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1043 | 0.04693 | 2.221 | 0.01227 | 0.1963 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00383 | 0.001675 | -2.286 | -0.007114 | -0.0005466 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000449 | 0.00001898 | 2.366 | 0.000007699 | 0.0000821 | fixed |
| male | 0.1403 | 0.02414 | 5.81 | 0.09296 | 0.1876 | fixed |
| sibling_count3 | -0.1194 | 0.04179 | -2.857 | -0.2013 | -0.0375 | fixed |
| sibling_count4 | -0.1057 | 0.04529 | -2.333 | -0.1944 | -0.01689 | fixed |
| sibling_count5 | -0.1304 | 0.04986 | -2.614 | -0.2281 | -0.03263 | fixed |
| sibling_count5+ | -0.126 | 0.04921 | -2.561 | -0.2225 | -0.02959 | fixed |
| birth_order_nonlinear2 | 0.006196 | 0.03202 | 0.1935 | -0.05657 | 0.06896 | fixed |
| birth_order_nonlinear3 | -0.02327 | 0.03865 | -0.6022 | -0.09902 | 0.05247 | fixed |
| birth_order_nonlinear4 | 0.05037 | 0.04648 | 1.084 | -0.04073 | 0.1415 | fixed |
| birth_order_nonlinear5 | 0.04243 | 0.05703 | 0.744 | -0.06934 | 0.1542 | fixed |
| birth_order_nonlinear5+ | -0.04304 | 0.05343 | -0.8055 | -0.1478 | 0.06169 | fixed |
| sd_(Intercept).mother_pidlink | 0.2968 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8872 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.7433 | 0.4145 | -1.793 | -1.556 | 0.06915 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1031 | 0.04699 | 2.194 | 0.011 | 0.1952 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003777 | 0.001678 | -2.251 | -0.007065 | -0.0004884 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004418 | 0.00001901 | 2.324 | 0.000006919 | 0.00008145 | fixed |
| male | 0.1401 | 0.02415 | 5.801 | 0.09278 | 0.1875 | fixed |
| count_birth_order2/2 | -0.03849 | 0.0622 | -0.6188 | -0.1604 | 0.08342 | fixed |
| count_birth_order1/3 | -0.1582 | 0.05423 | -2.917 | -0.2645 | -0.05192 | fixed |
| count_birth_order2/3 | -0.1277 | 0.05882 | -2.171 | -0.243 | -0.01239 | fixed |
| count_birth_order3/3 | -0.1121 | 0.0662 | -1.693 | -0.2418 | 0.01764 | fixed |
| count_birth_order1/4 | -0.1371 | 0.06414 | -2.138 | -0.2628 | -0.01142 | fixed |
| count_birth_order2/4 | -0.1088 | 0.06536 | -1.665 | -0.2369 | 0.01928 | fixed |
| count_birth_order3/4 | -0.2025 | 0.07174 | -2.823 | -0.3431 | -0.06191 | fixed |
| count_birth_order4/4 | 0.008894 | 0.07396 | 0.1203 | -0.1361 | 0.1539 | fixed |
| count_birth_order1/5 | -0.1709 | 0.07612 | -2.245 | -0.3201 | -0.02171 | fixed |
| count_birth_order2/5 | -0.161 | 0.08176 | -1.969 | -0.3212 | -0.0007141 | fixed |
| count_birth_order3/5 | -0.1594 | 0.07951 | -2.004 | -0.3152 | -0.003521 | fixed |
| count_birth_order4/5 | -0.03537 | 0.08242 | -0.4291 | -0.1969 | 0.1262 | fixed |
| count_birth_order5/5 | -0.1204 | 0.08264 | -1.457 | -0.2823 | 0.0416 | fixed |
| count_birth_order1/5+ | -0.084 | 0.07236 | -1.161 | -0.2258 | 0.05781 | fixed |
| count_birth_order2/5+ | -0.08335 | 0.0756 | -1.103 | -0.2315 | 0.06482 | fixed |
| count_birth_order3/5+ | -0.17 | 0.07416 | -2.293 | -0.3154 | -0.0247 | fixed |
| count_birth_order4/5+ | -0.201 | 0.07138 | -2.816 | -0.3409 | -0.06113 | fixed |
| count_birth_order5/5+ | -0.08702 | 0.07335 | -1.186 | -0.2308 | 0.05674 | fixed |
| count_birth_order5+/5+ | -0.1847 | 0.05372 | -3.439 | -0.29 | -0.07944 | fixed |
| sd_(Intercept).mother_pidlink | 0.2977 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8869 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 16143 | 16217 | -8061 | 16121 | NA | NA | NA |
| 12 | 16145 | 16225 | -8061 | 16121 | 0.01427 | 1 | 0.9049 |
| 16 | 16149 | 16256 | -8058 | 16117 | 4.361 | 4 | 0.3594 |
| 26 | 16158 | 16332 | -8053 | 16106 | 10.45 | 10 | 0.4015 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.7587 | 0.4191 | -1.81 | -1.58 | 0.06275 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1017 | 0.04758 | 2.138 | 0.00846 | 0.195 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003723 | 0.001698 | -2.192 | -0.007051 | -0.0003944 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004357 | 0.00001924 | 2.264 | 0.000005855 | 0.00008128 | fixed |
| male | 0.1344 | 0.02447 | 5.493 | 0.08644 | 0.1823 | fixed |
| sibling_count3 | -0.1099 | 0.03728 | -2.949 | -0.183 | -0.03687 | fixed |
| sibling_count4 | -0.09092 | 0.04034 | -2.254 | -0.17 | -0.01184 | fixed |
| sibling_count5 | -0.09754 | 0.04741 | -2.057 | -0.1905 | -0.004609 | fixed |
| sibling_count5+ | -0.1308 | 0.04103 | -3.188 | -0.2112 | -0.05037 | fixed |
| sd_(Intercept).mother_pidlink | 0.2968 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8863 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.7619 | 0.4192 | -1.818 | -1.583 | 0.05964 | fixed |
| birth_order | 0.004791 | 0.008228 | 0.5822 | -0.01134 | 0.02092 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1014 | 0.04758 | 2.131 | 0.008162 | 0.1947 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003721 | 0.001698 | -2.191 | -0.00705 | -0.0003926 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004374 | 0.00001924 | 2.273 | 0.000006022 | 0.00008146 | fixed |
| male | 0.1343 | 0.02447 | 5.487 | 0.08631 | 0.1822 | fixed |
| sibling_count3 | -0.1123 | 0.0375 | -2.994 | -0.1858 | -0.03878 | fixed |
| sibling_count4 | -0.09632 | 0.0414 | -2.327 | -0.1775 | -0.01518 | fixed |
| sibling_count5 | -0.1061 | 0.04965 | -2.137 | -0.2034 | -0.008801 | fixed |
| sibling_count5+ | -0.1486 | 0.05122 | -2.902 | -0.249 | -0.04824 | fixed |
| sd_(Intercept).mother_pidlink | 0.2968 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8863 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.7727 | 0.4197 | -1.841 | -1.595 | 0.04996 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1028 | 0.0476 | 2.16 | 0.009528 | 0.1961 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003761 | 0.001699 | -2.214 | -0.007092 | -0.0004311 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004398 | 0.00001926 | 2.284 | 0.000006237 | 0.00008172 | fixed |
| male | 0.1339 | 0.02447 | 5.473 | 0.08598 | 0.1819 | fixed |
| sibling_count3 | -0.1077 | 0.03832 | -2.811 | -0.1828 | -0.03261 | fixed |
| sibling_count4 | -0.1011 | 0.04312 | -2.345 | -0.1856 | -0.0166 | fixed |
| sibling_count5 | -0.1219 | 0.05202 | -2.344 | -0.2239 | -0.01998 | fixed |
| sibling_count5+ | -0.1329 | 0.05286 | -2.514 | -0.2365 | -0.02927 | fixed |
| birth_order_nonlinear2 | 0.01259 | 0.03137 | 0.4012 | -0.0489 | 0.07407 | fixed |
| birth_order_nonlinear3 | -0.007885 | 0.03878 | -0.2033 | -0.08389 | 0.06812 | fixed |
| birth_order_nonlinear4 | 0.06473 | 0.0493 | 1.313 | -0.03189 | 0.1613 | fixed |
| birth_order_nonlinear5 | 0.07644 | 0.06242 | 1.225 | -0.04591 | 0.1988 | fixed |
| birth_order_nonlinear5+ | -0.03802 | 0.06175 | -0.6156 | -0.159 | 0.08301 | fixed |
| sd_(Intercept).mother_pidlink | 0.2956 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.8866 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.7574 | 0.4207 | -1.8 | -1.582 | 0.06723 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1027 | 0.04771 | 2.152 | 0.009185 | 0.1962 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003749 | 0.001703 | -2.201 | -0.007088 | -0.0004106 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004374 | 0.00001931 | 2.266 | 0.0000059 | 0.00008159 | fixed |
| male | 0.1337 | 0.02449 | 5.46 | 0.08574 | 0.1818 | fixed |
| count_birth_order2/2 | -0.03314 | 0.05536 | -0.5986 | -0.1417 | 0.07537 | fixed |
| count_birth_order1/3 | -0.1392 | 0.04945 | -2.815 | -0.2361 | -0.04228 | fixed |
| count_birth_order2/3 | -0.1234 | 0.05468 | -2.257 | -0.2306 | -0.01625 | fixed |
| count_birth_order3/3 | -0.08378 | 0.06007 | -1.395 | -0.2015 | 0.03395 | fixed |
| count_birth_order1/4 | -0.1067 | 0.06151 | -1.735 | -0.2273 | 0.01385 | fixed |
| count_birth_order2/4 | -0.1168 | 0.06327 | -1.846 | -0.2408 | 0.007236 | fixed |
| count_birth_order3/4 | -0.1429 | 0.06628 | -2.156 | -0.2728 | -0.01301 | fixed |
| count_birth_order4/4 | -0.02894 | 0.07005 | -0.4132 | -0.1662 | 0.1084 | fixed |
| count_birth_order1/5 | -0.2023 | 0.08297 | -2.438 | -0.3649 | -0.03966 | fixed |
| count_birth_order2/5 | -0.03606 | 0.0917 | -0.3932 | -0.2158 | 0.1437 | fixed |
| count_birth_order3/5 | -0.1885 | 0.08748 | -2.154 | -0.3599 | -0.01701 | fixed |
| count_birth_order4/5 | -0.05182 | 0.08429 | -0.6147 | -0.217 | 0.1134 | fixed |
| count_birth_order5/5 | -0.04479 | 0.08956 | -0.5001 | -0.2203 | 0.1307 | fixed |
| count_birth_order1/5+ | -0.1186 | 0.08445 | -1.404 | -0.2841 | 0.04694 | fixed |
| count_birth_order2/5+ | -0.06131 | 0.08375 | -0.7321 | -0.2255 | 0.1028 | fixed |
| count_birth_order3/5+ | -0.1921 | 0.08298 | -2.315 | -0.3548 | -0.02946 | fixed |
| count_birth_order4/5+ | -0.1344 | 0.08117 | -1.656 | -0.2935 | 0.02468 | fixed |
| count_birth_order5/5+ | -0.08222 | 0.0746 | -1.102 | -0.2284 | 0.06399 | fixed |
| count_birth_order5+/5+ | -0.1868 | 0.05579 | -3.349 | -0.2961 | -0.07746 | fixed |
| sd_(Intercept).mother_pidlink | 0.2954 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.887 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 15673 | 15746 | -7826 | 15651 | NA | NA | NA |
| 12 | 15675 | 15755 | -7825 | 15651 | 0.3398 | 1 | 0.5599 |
| 16 | 15678 | 15785 | -7823 | 15646 | 4.718 | 4 | 0.3175 |
| 26 | 15692 | 15865 | -7820 | 15640 | 6.553 | 10 | 0.7669 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = riskA)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.147 | 0.1737 | 6.604 | 0.8068 | 1.488 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.09252 | 0.01678 | -5.513 | -0.1254 | -0.05963 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.002406 | 0.0004989 | 4.822 | 0.001428 | 0.003383 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001908 | 0.000004653 | -4.1 | -0.00002819 | -0.000009956 | fixed |
| male | -0.2332 | 0.01776 | -13.13 | -0.268 | -0.1984 | fixed |
| sibling_count3 | 0.003204 | 0.03507 | 0.09136 | -0.06554 | 0.07195 | fixed |
| sibling_count4 | 0.004187 | 0.03594 | 0.1165 | -0.06626 | 0.07464 | fixed |
| sibling_count5 | -0.008956 | 0.03722 | -0.2407 | -0.0819 | 0.06399 | fixed |
| sibling_count5+ | 0.04878 | 0.02933 | 1.663 | -0.008715 | 0.1063 | fixed |
| sd_(Intercept).mother_pidlink | 0.2501 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9575 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.149 | 0.1738 | 6.615 | 0.8089 | 1.49 | fixed |
| birth_order | 0.002926 | 0.003685 | 0.794 | -0.004297 | 0.01015 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.09344 | 0.01682 | -5.555 | -0.1264 | -0.06047 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.002438 | 0.0005005 | 4.871 | 0.001457 | 0.003419 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001937 | 0.000004668 | -4.15 | -0.00002852 | -0.00001022 | fixed |
| male | -0.2333 | 0.01776 | -13.14 | -0.2681 | -0.1985 | fixed |
| sibling_count3 | 0.002364 | 0.03509 | 0.06739 | -0.0664 | 0.07113 | fixed |
| sibling_count4 | 0.002011 | 0.03604 | 0.05579 | -0.06863 | 0.07265 | fixed |
| sibling_count5 | -0.01272 | 0.03751 | -0.3391 | -0.08624 | 0.0608 | fixed |
| sibling_count5+ | 0.03741 | 0.03264 | 1.146 | -0.02656 | 0.1014 | fixed |
| sd_(Intercept).mother_pidlink | 0.2494 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9577 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.134 | 0.1743 | 6.508 | 0.7926 | 1.476 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.09246 | 0.01683 | -5.495 | -0.1254 | -0.05948 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.002401 | 0.0005007 | 4.795 | 0.001419 | 0.003382 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001898 | 0.00000467 | -4.064 | -0.00002813 | -0.000009823 | fixed |
| male | -0.2334 | 0.01776 | -13.14 | -0.2682 | -0.1986 | fixed |
| sibling_count3 | 0.00682 | 0.03566 | 0.1912 | -0.06308 | 0.07672 | fixed |
| sibling_count4 | 0.006205 | 0.03719 | 0.1669 | -0.06668 | 0.07909 | fixed |
| sibling_count5 | -0.01895 | 0.03919 | -0.4834 | -0.09576 | 0.05787 | fixed |
| sibling_count5+ | 0.04327 | 0.03453 | 1.253 | -0.02441 | 0.111 | fixed |
| birth_order_nonlinear2 | 0.03422 | 0.02611 | 1.311 | -0.01694 | 0.08539 | fixed |
| birth_order_nonlinear3 | -0.005286 | 0.0307 | -0.1722 | -0.06545 | 0.05488 | fixed |
| birth_order_nonlinear4 | 0.015 | 0.03513 | 0.4268 | -0.05386 | 0.08385 | fixed |
| birth_order_nonlinear5 | 0.08311 | 0.03947 | 2.106 | 0.005747 | 0.1605 | fixed |
| birth_order_nonlinear5+ | 0.009131 | 0.03275 | 0.2789 | -0.05505 | 0.07331 | fixed |
| sd_(Intercept).mother_pidlink | 0.2505 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9573 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.152 | 0.175 | 6.581 | 0.8086 | 1.495 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.09299 | 0.01682 | -5.528 | -0.126 | -0.06002 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.002411 | 0.0005005 | 4.817 | 0.00143 | 0.003392 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001901 | 0.000004669 | -4.072 | -0.00002816 | -0.000009861 | fixed |
| male | -0.2341 | 0.01775 | -13.19 | -0.2689 | -0.1993 | fixed |
| count_birth_order2/2 | 0.005908 | 0.05039 | 0.1173 | -0.09284 | 0.1047 | fixed |
| count_birth_order1/3 | -0.04965 | 0.04725 | -1.051 | -0.1423 | 0.04296 | fixed |
| count_birth_order2/3 | 0.02964 | 0.05332 | 0.5559 | -0.07487 | 0.1342 | fixed |
| count_birth_order3/3 | 0.08396 | 0.05874 | 1.429 | -0.03117 | 0.1991 | fixed |
| count_birth_order1/4 | 0.05371 | 0.05395 | 0.9955 | -0.05203 | 0.1594 | fixed |
| count_birth_order2/4 | -0.01678 | 0.05658 | -0.2965 | -0.1277 | 0.09412 | fixed |
| count_birth_order3/4 | -0.09029 | 0.06134 | -1.472 | -0.2105 | 0.02993 | fixed |
| count_birth_order4/4 | 0.07955 | 0.06589 | 1.207 | -0.0496 | 0.2087 | fixed |
| count_birth_order1/5 | -0.02778 | 0.062 | -0.4482 | -0.1493 | 0.09372 | fixed |
| count_birth_order2/5 | 0.04518 | 0.06404 | 0.7054 | -0.08035 | 0.1707 | fixed |
| count_birth_order3/5 | 0.01774 | 0.06616 | 0.2682 | -0.1119 | 0.1474 | fixed |
| count_birth_order4/5 | -0.1898 | 0.06999 | -2.712 | -0.327 | -0.05266 | fixed |
| count_birth_order5/5 | 0.1188 | 0.07047 | 1.686 | -0.01933 | 0.2569 | fixed |
| count_birth_order1/5+ | 0.02633 | 0.04975 | 0.5293 | -0.07118 | 0.1238 | fixed |
| count_birth_order2/5+ | 0.1002 | 0.05139 | 1.949 | -0.0005436 | 0.2009 | fixed |
| count_birth_order3/5+ | -0.006486 | 0.05003 | -0.1296 | -0.1045 | 0.09157 | fixed |
| count_birth_order4/5+ | 0.0823 | 0.049 | 1.68 | -0.01373 | 0.1783 | fixed |
| count_birth_order5/5+ | 0.09391 | 0.04895 | 1.919 | -0.00202 | 0.1898 | fixed |
| count_birth_order5+/5+ | 0.04251 | 0.03807 | 1.116 | -0.03211 | 0.1171 | fixed |
| sd_(Intercept).mother_pidlink | 0.2503 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9567 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 34828 | 34909 | -17403 | 34806 | NA | NA | NA |
| 12 | 34829 | 34918 | -17403 | 34805 | 0.6324 | 1 | 0.4265 |
| 16 | 34831 | 34949 | -17399 | 34799 | 6.352 | 4 | 0.1743 |
| 26 | 34825 | 35018 | -17386 | 34773 | 25.71 | 10 | 0.004149 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.577 | 0.4493 | 3.51 | 0.6964 | 2.458 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.134 | 0.05105 | -2.626 | -0.2341 | -0.034 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003493 | 0.001825 | 1.914 | -0.00008355 | 0.007069 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002836 | 0.0000207 | -1.37 | -0.00006894 | 0.00001222 | fixed |
| male | -0.2542 | 0.02616 | -9.717 | -0.3055 | -0.2029 | fixed |
| sibling_count3 | -0.01637 | 0.04026 | -0.4067 | -0.09528 | 0.06253 | fixed |
| sibling_count4 | 0.01001 | 0.04325 | 0.2314 | -0.07475 | 0.09477 | fixed |
| sibling_count5 | 0.02769 | 0.04899 | 0.5652 | -0.06832 | 0.1237 | fixed |
| sibling_count5+ | 0.1299 | 0.04299 | 3.021 | 0.0456 | 0.2141 | fixed |
| sd_(Intercept).mother_pidlink | 0.2518 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9226 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.58 | 0.4494 | 3.516 | 0.6991 | 2.461 | fixed |
| birth_order | -0.003278 | 0.008588 | -0.3817 | -0.02011 | 0.01355 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1339 | 0.05105 | -2.624 | -0.234 | -0.03387 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003494 | 0.001825 | 1.915 | -0.00008234 | 0.00707 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000285 | 0.00002071 | -1.376 | -0.00006909 | 0.00001208 | fixed |
| male | -0.2541 | 0.02616 | -9.71 | -0.3054 | -0.2028 | fixed |
| sibling_count3 | -0.01474 | 0.04049 | -0.3641 | -0.0941 | 0.06462 | fixed |
| sibling_count4 | 0.01385 | 0.0444 | 0.3118 | -0.07318 | 0.1009 | fixed |
| sibling_count5 | 0.03389 | 0.05161 | 0.6566 | -0.06727 | 0.1351 | fixed |
| sibling_count5+ | 0.1424 | 0.05406 | 2.634 | 0.03642 | 0.2483 | fixed |
| sd_(Intercept).mother_pidlink | 0.2515 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9228 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.557 | 0.4502 | 3.459 | 0.6751 | 2.44 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1325 | 0.05109 | -2.593 | -0.2326 | -0.03235 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003436 | 0.001826 | 1.881 | -0.0001438 | 0.007016 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002774 | 0.00002073 | -1.338 | -0.00006837 | 0.00001289 | fixed |
| male | -0.2537 | 0.02617 | -9.693 | -0.305 | -0.2024 | fixed |
| sibling_count3 | -0.02883 | 0.04149 | -0.6949 | -0.1101 | 0.05249 | fixed |
| sibling_count4 | 0.003924 | 0.04641 | 0.08454 | -0.08704 | 0.09489 | fixed |
| sibling_count5 | 0.01893 | 0.05466 | 0.3463 | -0.08821 | 0.1261 | fixed |
| sibling_count5+ | 0.1267 | 0.05591 | 2.266 | 0.01712 | 0.2363 | fixed |
| birth_order_nonlinear2 | 0.01925 | 0.03437 | 0.5601 | -0.04811 | 0.0866 | fixed |
| birth_order_nonlinear3 | 0.05381 | 0.04222 | 1.274 | -0.02895 | 0.1366 | fixed |
| birth_order_nonlinear4 | -0.02119 | 0.05203 | -0.4073 | -0.1232 | 0.08078 | fixed |
| birth_order_nonlinear5 | 0.03094 | 0.0651 | 0.4752 | -0.09666 | 0.1585 | fixed |
| birth_order_nonlinear5+ | -0.00119 | 0.06463 | -0.01842 | -0.1279 | 0.1255 | fixed |
| sd_(Intercept).mother_pidlink | 0.2539 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9223 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.526 | 0.4507 | 3.385 | 0.6422 | 2.409 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1286 | 0.05114 | -2.514 | -0.2288 | -0.02832 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003327 | 0.001828 | 1.82 | -0.0002567 | 0.00691 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002686 | 0.00002075 | -1.294 | -0.00006754 | 0.00001381 | fixed |
| male | -0.2536 | 0.02619 | -9.683 | -0.3049 | -0.2022 | fixed |
| count_birth_order2/2 | -0.008658 | 0.06139 | -0.141 | -0.129 | 0.1117 | fixed |
| count_birth_order1/3 | -0.1013 | 0.05393 | -1.878 | -0.207 | 0.00441 | fixed |
| count_birth_order2/3 | 0.01465 | 0.05898 | 0.2484 | -0.1009 | 0.1302 | fixed |
| count_birth_order3/3 | 0.08765 | 0.06512 | 1.346 | -0.03997 | 0.2153 | fixed |
| count_birth_order1/4 | 0.05273 | 0.06664 | 0.7913 | -0.07788 | 0.1834 | fixed |
| count_birth_order2/4 | -0.01304 | 0.06801 | -0.1917 | -0.1463 | 0.1203 | fixed |
| count_birth_order3/4 | -0.04041 | 0.07259 | -0.5568 | -0.1827 | 0.1019 | fixed |
| count_birth_order4/4 | 0.02005 | 0.07383 | 0.2715 | -0.1246 | 0.1647 | fixed |
| count_birth_order1/5 | 0.1057 | 0.08996 | 1.175 | -0.07063 | 0.282 | fixed |
| count_birth_order2/5 | -0.01872 | 0.09657 | -0.1939 | -0.208 | 0.1706 | fixed |
| count_birth_order3/5 | 0.02719 | 0.0897 | 0.3031 | -0.1486 | 0.203 | fixed |
| count_birth_order4/5 | 0.0244 | 0.08554 | 0.2853 | -0.1432 | 0.1921 | fixed |
| count_birth_order5/5 | -0.02271 | 0.08904 | -0.2551 | -0.1972 | 0.1518 | fixed |
| count_birth_order1/5+ | 0.1101 | 0.09201 | 1.197 | -0.07023 | 0.2905 | fixed |
| count_birth_order2/5+ | 0.1728 | 0.08828 | 1.957 | -0.0002416 | 0.3458 | fixed |
| count_birth_order3/5+ | 0.1931 | 0.08797 | 2.195 | 0.02068 | 0.3655 | fixed |
| count_birth_order4/5+ | -0.004091 | 0.08442 | -0.04846 | -0.1696 | 0.1614 | fixed |
| count_birth_order5/5+ | 0.1929 | 0.07866 | 2.452 | 0.03868 | 0.347 | fixed |
| count_birth_order5+/5+ | 0.1152 | 0.05806 | 1.985 | 0.001439 | 0.229 | fixed |
| sd_(Intercept).mother_pidlink | 0.2554 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9215 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 14660 | 14732 | -7319 | 14638 | NA | NA | NA |
| 12 | 14661 | 14740 | -7319 | 14637 | 0.1468 | 1 | 0.7016 |
| 16 | 14667 | 14772 | -7317 | 14635 | 2.604 | 4 | 0.6262 |
| 26 | 14672 | 14844 | -7310 | 14620 | 14.37 | 10 | 0.1569 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.549 | 0.4478 | 3.46 | 0.6717 | 2.427 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1301 | 0.05091 | -2.555 | -0.2298 | -0.0303 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003384 | 0.00182 | 1.859 | -0.0001836 | 0.006951 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002719 | 0.00002066 | -1.316 | -0.00006768 | 0.0000133 | fixed |
| male | -0.2574 | 0.02605 | -9.882 | -0.3085 | -0.2064 | fixed |
| sibling_count3 | -0.03451 | 0.04357 | -0.792 | -0.1199 | 0.05089 | fixed |
| sibling_count4 | -0.03854 | 0.04574 | -0.8425 | -0.1282 | 0.05111 | fixed |
| sibling_count5 | 0.02241 | 0.04858 | 0.4612 | -0.07281 | 0.1176 | fixed |
| sibling_count5+ | 0.0725 | 0.04271 | 1.697 | -0.01122 | 0.1562 | fixed |
| sd_(Intercept).mother_pidlink | 0.2535 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9221 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.545 | 0.4479 | 3.45 | 0.6672 | 2.423 | fixed |
| birth_order | 0.003578 | 0.007458 | 0.4798 | -0.01104 | 0.01819 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1301 | 0.05091 | -2.555 | -0.2299 | -0.03029 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003378 | 0.00182 | 1.856 | -0.00019 | 0.006945 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002699 | 0.00002066 | -1.306 | -0.00006748 | 0.00001351 | fixed |
| male | -0.2575 | 0.02605 | -9.886 | -0.3086 | -0.2065 | fixed |
| sibling_count3 | -0.03628 | 0.04373 | -0.8296 | -0.122 | 0.04943 | fixed |
| sibling_count4 | -0.04254 | 0.0465 | -0.9149 | -0.1337 | 0.0486 | fixed |
| sibling_count5 | 0.01616 | 0.0503 | 0.3213 | -0.08242 | 0.1147 | fixed |
| sibling_count5+ | 0.0592 | 0.05092 | 1.163 | -0.04059 | 0.159 | fixed |
| sd_(Intercept).mother_pidlink | 0.2537 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9222 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.522 | 0.4487 | 3.392 | 0.6425 | 2.401 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.128 | 0.05094 | -2.513 | -0.2279 | -0.02816 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003294 | 0.001822 | 1.808 | -0.0002767 | 0.006864 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002588 | 0.00002068 | -1.252 | -0.00006642 | 0.00001465 | fixed |
| male | -0.2576 | 0.02605 | -9.888 | -0.3086 | -0.2065 | fixed |
| sibling_count3 | -0.05732 | 0.04465 | -1.284 | -0.1448 | 0.03021 | fixed |
| sibling_count4 | -0.06546 | 0.04836 | -1.354 | -0.1602 | 0.02932 | fixed |
| sibling_count5 | -0.0008842 | 0.05303 | -0.01667 | -0.1048 | 0.103 | fixed |
| sibling_count5+ | 0.0348 | 0.05268 | 0.6606 | -0.06845 | 0.138 | fixed |
| birth_order_nonlinear2 | 0.03458 | 0.03489 | 0.9911 | -0.0338 | 0.103 | fixed |
| birth_order_nonlinear3 | 0.09857 | 0.04209 | 2.342 | 0.01609 | 0.1811 | fixed |
| birth_order_nonlinear4 | 0.0352 | 0.05032 | 0.6995 | -0.06343 | 0.1338 | fixed |
| birth_order_nonlinear5 | 0.003997 | 0.06168 | 0.06481 | -0.1169 | 0.1249 | fixed |
| birth_order_nonlinear5+ | 0.07155 | 0.05752 | 1.244 | -0.0412 | 0.1843 | fixed |
| sd_(Intercept).mother_pidlink | 0.2558 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9214 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.49 | 0.4492 | 3.317 | 0.6097 | 2.371 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1225 | 0.05098 | -2.404 | -0.2224 | -0.02261 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003108 | 0.001823 | 1.705 | -0.0004651 | 0.006681 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002392 | 0.0000207 | -1.156 | -0.00006449 | 0.00001665 | fixed |
| male | -0.2572 | 0.02606 | -9.871 | -0.3083 | -0.2061 | fixed |
| count_birth_order2/2 | -0.01902 | 0.06687 | -0.2844 | -0.1501 | 0.112 | fixed |
| count_birth_order1/3 | -0.1438 | 0.05846 | -2.46 | -0.2584 | -0.02923 | fixed |
| count_birth_order2/3 | 0.003974 | 0.06319 | 0.0629 | -0.1199 | 0.1278 | fixed |
| count_birth_order3/3 | 0.08898 | 0.0708 | 1.257 | -0.04978 | 0.2277 | fixed |
| count_birth_order1/4 | -0.01275 | 0.06936 | -0.1838 | -0.1487 | 0.1232 | fixed |
| count_birth_order2/4 | -0.1237 | 0.07019 | -1.762 | -0.2612 | 0.01391 | fixed |
| count_birth_order3/4 | -0.04247 | 0.07755 | -0.5477 | -0.1945 | 0.1095 | fixed |
| count_birth_order4/4 | 0.01075 | 0.07811 | 0.1376 | -0.1423 | 0.1638 | fixed |
| count_birth_order1/5 | 0.01399 | 0.08174 | 0.1712 | -0.1462 | 0.1742 | fixed |
| count_birth_order2/5 | 0.009527 | 0.08838 | 0.1078 | -0.1637 | 0.1827 | fixed |
| count_birth_order3/5 | 0.1061 | 0.08479 | 1.251 | -0.06012 | 0.2722 | fixed |
| count_birth_order4/5 | 0.02947 | 0.08793 | 0.3351 | -0.1429 | 0.2018 | fixed |
| count_birth_order5/5 | -0.0916 | 0.08745 | -1.047 | -0.263 | 0.07981 | fixed |
| count_birth_order1/5+ | 0.001461 | 0.07901 | 0.01849 | -0.1534 | 0.1563 | fixed |
| count_birth_order2/5+ | 0.1332 | 0.08149 | 1.635 | -0.02647 | 0.293 | fixed |
| count_birth_order3/5+ | 0.06555 | 0.08021 | 0.8172 | -0.09166 | 0.2228 | fixed |
| count_birth_order4/5+ | -0.01491 | 0.07757 | -0.1922 | -0.1669 | 0.1371 | fixed |
| count_birth_order5/5+ | 0.07852 | 0.07906 | 0.9931 | -0.07644 | 0.2335 | fixed |
| count_birth_order5+/5+ | 0.08841 | 0.05687 | 1.555 | -0.02305 | 0.1999 | fixed |
| sd_(Intercept).mother_pidlink | 0.2571 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9206 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 14794 | 14866 | -7386 | 14772 | NA | NA | NA |
| 12 | 14796 | 14875 | -7386 | 14772 | 0.2304 | 1 | 0.6312 |
| 16 | 14797 | 14903 | -7383 | 14765 | 6.297 | 4 | 0.178 |
| 26 | 14802 | 14973 | -7375 | 14750 | 15.5 | 10 | 0.1149 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.476 | 0.455 | 3.243 | 0.5838 | 2.367 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1219 | 0.05172 | -2.358 | -0.2233 | -0.02058 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003027 | 0.00185 | 1.637 | -0.000598 | 0.006652 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002277 | 0.00002101 | -1.084 | -0.00006394 | 0.0000184 | fixed |
| male | -0.259 | 0.02642 | -9.801 | -0.3108 | -0.2072 | fixed |
| sibling_count3 | -0.01595 | 0.03977 | -0.4011 | -0.09389 | 0.06199 | fixed |
| sibling_count4 | 0.002577 | 0.04305 | 0.05986 | -0.0818 | 0.08695 | fixed |
| sibling_count5 | 0.06957 | 0.05029 | 1.383 | -0.02899 | 0.1681 | fixed |
| sibling_count5+ | 0.1304 | 0.04352 | 2.997 | 0.04515 | 0.2157 | fixed |
| sd_(Intercept).mother_pidlink | 0.255 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.922 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.477 | 0.4551 | 3.246 | 0.5854 | 2.369 | fixed |
| birth_order | -0.002007 | 0.008824 | -0.2275 | -0.0193 | 0.01529 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1219 | 0.05173 | -2.356 | -0.2233 | -0.02048 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003028 | 0.00185 | 1.637 | -0.0005978 | 0.006653 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002285 | 0.00002101 | -1.088 | -0.00006403 | 0.00001833 | fixed |
| male | -0.2589 | 0.02643 | -9.798 | -0.3107 | -0.2071 | fixed |
| sibling_count3 | -0.01493 | 0.04002 | -0.3731 | -0.09337 | 0.06351 | fixed |
| sibling_count4 | 0.004905 | 0.04426 | 0.1108 | -0.08183 | 0.09164 | fixed |
| sibling_count5 | 0.0732 | 0.05277 | 1.387 | -0.03022 | 0.1766 | fixed |
| sibling_count5+ | 0.1381 | 0.0549 | 2.515 | 0.03046 | 0.2456 | fixed |
| sd_(Intercept).mother_pidlink | 0.2549 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9221 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.46 | 0.4559 | 3.203 | 0.5665 | 2.354 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1207 | 0.05177 | -2.332 | -0.2222 | -0.01925 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.002979 | 0.001851 | 1.609 | -0.0006496 | 0.006607 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002217 | 0.00002103 | -1.054 | -0.00006339 | 0.00001905 | fixed |
| male | -0.2584 | 0.02643 | -9.775 | -0.3102 | -0.2066 | fixed |
| sibling_count3 | -0.02704 | 0.04106 | -0.6587 | -0.1075 | 0.05342 | fixed |
| sibling_count4 | -0.002276 | 0.04631 | -0.04916 | -0.09303 | 0.08848 | fixed |
| sibling_count5 | 0.06283 | 0.0556 | 1.13 | -0.04614 | 0.1718 | fixed |
| sibling_count5+ | 0.1202 | 0.05686 | 2.113 | 0.008714 | 0.2316 | fixed |
| birth_order_nonlinear2 | 0.01531 | 0.03429 | 0.4465 | -0.05189 | 0.08251 | fixed |
| birth_order_nonlinear3 | 0.04702 | 0.04216 | 1.115 | -0.03561 | 0.1297 | fixed |
| birth_order_nonlinear4 | -0.02296 | 0.05335 | -0.4304 | -0.1275 | 0.08161 | fixed |
| birth_order_nonlinear5 | 0.02594 | 0.06801 | 0.3815 | -0.1073 | 0.1592 | fixed |
| birth_order_nonlinear5+ | 0.01797 | 0.0667 | 0.2694 | -0.1128 | 0.1487 | fixed |
| sd_(Intercept).mother_pidlink | 0.2571 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9217 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.418 | 0.4564 | 3.108 | 0.5238 | 2.313 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1144 | 0.05181 | -2.207 | -0.2159 | -0.01281 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.002775 | 0.001853 | 1.497 | -0.0008571 | 0.006406 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00002013 | 0.00002105 | -0.9565 | -0.00006139 | 0.00002112 | fixed |
| male | -0.2579 | 0.02644 | -9.756 | -0.3098 | -0.2061 | fixed |
| count_birth_order2/2 | -0.03894 | 0.05986 | -0.6506 | -0.1563 | 0.07838 | fixed |
| count_birth_order1/3 | -0.1122 | 0.05335 | -2.103 | -0.2168 | -0.007653 | fixed |
| count_birth_order2/3 | -0.005963 | 0.05896 | -0.1011 | -0.1215 | 0.1096 | fixed |
| count_birth_order3/3 | 0.0912 | 0.06371 | 1.432 | -0.03367 | 0.2161 | fixed |
| count_birth_order1/4 | 0.0365 | 0.06697 | 0.5451 | -0.09475 | 0.1678 | fixed |
| count_birth_order2/4 | 0.00438 | 0.06821 | 0.06421 | -0.1293 | 0.1381 | fixed |
| count_birth_order3/4 | -0.08139 | 0.07209 | -1.129 | -0.2227 | 0.05991 | fixed |
| count_birth_order4/4 | -0.01876 | 0.07401 | -0.2534 | -0.1638 | 0.1263 | fixed |
| count_birth_order1/5 | 0.1228 | 0.09013 | 1.362 | -0.0539 | 0.2994 | fixed |
| count_birth_order2/5 | 0.01063 | 0.09959 | 0.1067 | -0.1846 | 0.2058 | fixed |
| count_birth_order3/5 | 0.05929 | 0.09337 | 0.6351 | -0.1237 | 0.2423 | fixed |
| count_birth_order4/5 | 0.09376 | 0.09014 | 1.04 | -0.0829 | 0.2704 | fixed |
| count_birth_order5/5 | -0.02808 | 0.09563 | -0.2937 | -0.2155 | 0.1594 | fixed |
| count_birth_order1/5+ | 0.08835 | 0.09431 | 0.9368 | -0.09649 | 0.2732 | fixed |
| count_birth_order2/5+ | 0.1599 | 0.09032 | 1.771 | -0.0171 | 0.3369 | fixed |
| count_birth_order3/5+ | 0.1489 | 0.08977 | 1.659 | -0.02704 | 0.3249 | fixed |
| count_birth_order4/5+ | -0.02845 | 0.0881 | -0.3229 | -0.2011 | 0.1442 | fixed |
| count_birth_order5/5+ | 0.1909 | 0.08075 | 2.365 | 0.03267 | 0.3492 | fixed |
| count_birth_order5+/5+ | 0.119 | 0.05923 | 2.01 | 0.002956 | 0.2351 | fixed |
| sd_(Intercept).mother_pidlink | 0.2591 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9205 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 14385 | 14457 | -7181 | 14363 | NA | NA | NA |
| 12 | 14386 | 14465 | -7181 | 14362 | 0.05235 | 1 | 0.819 |
| 16 | 14392 | 14497 | -7180 | 14360 | 2.057 | 4 | 0.7253 |
| 26 | 14395 | 14565 | -7171 | 14343 | 17.69 | 10 | 0.06035 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = riskB)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.424 | 0.1696 | 2.501 | 0.09167 | 0.7563 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04127 | 0.01634 | -2.526 | -0.07329 | -0.009251 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00138 | 0.0004842 | 2.849 | 0.0004305 | 0.002329 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001361 | 0.000004497 | -3.027 | -0.00002243 | -0.000004801 | fixed |
| male | -0.1475 | 0.01742 | -8.462 | -0.1816 | -0.1133 | fixed |
| sibling_count3 | -0.01464 | 0.03423 | -0.4277 | -0.08174 | 0.05246 | fixed |
| sibling_count4 | -0.0176 | 0.03527 | -0.4989 | -0.08672 | 0.05153 | fixed |
| sibling_count5 | -0.02489 | 0.03632 | -0.6853 | -0.09608 | 0.0463 | fixed |
| sibling_count5+ | 0.01225 | 0.02875 | 0.4262 | -0.0441 | 0.0686 | fixed |
| sd_(Intercept).mother_pidlink | 0.2288 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9735 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.423 | 0.1696 | 2.494 | 0.09063 | 0.7555 | fixed |
| birth_order | -0.001017 | 0.003626 | -0.2805 | -0.008125 | 0.006091 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04093 | 0.01638 | -2.498 | -0.07304 | -0.008821 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001368 | 0.000486 | 2.814 | 0.0004152 | 0.00232 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001351 | 0.000004514 | -2.993 | -0.00002235 | -0.000004661 | fixed |
| male | -0.1474 | 0.01743 | -8.459 | -0.1816 | -0.1133 | fixed |
| sibling_count3 | -0.01438 | 0.03425 | -0.4198 | -0.0815 | 0.05275 | fixed |
| sibling_count4 | -0.01686 | 0.03537 | -0.4768 | -0.08618 | 0.05245 | fixed |
| sibling_count5 | -0.02362 | 0.0366 | -0.6454 | -0.09537 | 0.04812 | fixed |
| sibling_count5+ | 0.01615 | 0.03193 | 0.5057 | -0.04643 | 0.07873 | fixed |
| sd_(Intercept).mother_pidlink | 0.2289 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9735 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.4076 | 0.1701 | 2.396 | 0.0742 | 0.741 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04064 | 0.01639 | -2.48 | -0.07275 | -0.008521 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001357 | 0.0004861 | 2.792 | 0.0004043 | 0.00231 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001338 | 0.000004514 | -2.965 | -0.00002223 | -0.000004536 | fixed |
| male | -0.1474 | 0.01742 | -8.459 | -0.1815 | -0.1132 | fixed |
| sibling_count3 | -0.008283 | 0.03478 | -0.2382 | -0.07645 | 0.05988 | fixed |
| sibling_count4 | -0.009089 | 0.03645 | -0.2493 | -0.08053 | 0.06236 | fixed |
| sibling_count5 | -0.0268 | 0.03822 | -0.7012 | -0.1017 | 0.04811 | fixed |
| sibling_count5+ | 0.01856 | 0.03372 | 0.5504 | -0.04753 | 0.08465 | fixed |
| birth_order_nonlinear2 | 0.03051 | 0.02544 | 1.199 | -0.01936 | 0.08038 | fixed |
| birth_order_nonlinear3 | -0.02082 | 0.03014 | -0.6907 | -0.0799 | 0.03826 | fixed |
| birth_order_nonlinear4 | -0.006055 | 0.03439 | -0.1761 | -0.07345 | 0.06134 | fixed |
| birth_order_nonlinear5 | 0.07219 | 0.03877 | 1.862 | -0.003801 | 0.1482 | fixed |
| birth_order_nonlinear5+ | -0.008571 | 0.03201 | -0.2678 | -0.07131 | 0.05417 | fixed |
| sd_(Intercept).mother_pidlink | 0.2285 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9734 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3925 | 0.1709 | 2.297 | 0.05761 | 0.7274 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04053 | 0.01639 | -2.473 | -0.07265 | -0.008408 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001342 | 0.0004862 | 2.759 | 0.0003888 | 0.002295 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001314 | 0.000004517 | -2.908 | -0.00002199 | -0.000004282 | fixed |
| male | -0.1476 | 0.01743 | -8.472 | -0.1818 | -0.1135 | fixed |
| count_birth_order2/2 | 0.07737 | 0.04949 | 1.563 | -0.01963 | 0.1744 | fixed |
| count_birth_order1/3 | -0.02647 | 0.04629 | -0.5719 | -0.1172 | 0.06426 | fixed |
| count_birth_order2/3 | 0.0378 | 0.0516 | 0.7325 | -0.06334 | 0.1389 | fixed |
| count_birth_order3/3 | 0.06454 | 0.05807 | 1.111 | -0.04928 | 0.1784 | fixed |
| count_birth_order1/4 | 0.04895 | 0.05288 | 0.9257 | -0.05469 | 0.1526 | fixed |
| count_birth_order2/4 | 0.03463 | 0.05584 | 0.6202 | -0.07482 | 0.1441 | fixed |
| count_birth_order3/4 | -0.06608 | 0.0613 | -1.078 | -0.1862 | 0.05407 | fixed |
| count_birth_order4/4 | 0.001373 | 0.06432 | 0.02135 | -0.1247 | 0.1274 | fixed |
| count_birth_order1/5 | 0.004777 | 0.06038 | 0.07912 | -0.1136 | 0.1231 | fixed |
| count_birth_order2/5 | -0.01449 | 0.06268 | -0.2311 | -0.1373 | 0.1084 | fixed |
| count_birth_order3/5 | 0.03646 | 0.06432 | 0.5669 | -0.0896 | 0.1625 | fixed |
| count_birth_order4/5 | -0.01936 | 0.06885 | -0.2811 | -0.1543 | 0.1156 | fixed |
| count_birth_order5/5 | 0.01505 | 0.06971 | 0.2159 | -0.1216 | 0.1517 | fixed |
| count_birth_order1/5+ | 0.06653 | 0.04862 | 1.368 | -0.02876 | 0.1618 | fixed |
| count_birth_order2/5+ | 0.06346 | 0.0502 | 1.264 | -0.03492 | 0.1618 | fixed |
| count_birth_order3/5+ | -0.03022 | 0.04923 | -0.6138 | -0.1267 | 0.06627 | fixed |
| count_birth_order4/5+ | 0.03321 | 0.0483 | 0.6876 | -0.06145 | 0.1279 | fixed |
| count_birth_order5/5+ | 0.1256 | 0.04827 | 2.602 | 0.031 | 0.2202 | fixed |
| count_birth_order5+/5+ | 0.02817 | 0.03751 | 0.7511 | -0.04534 | 0.1017 | fixed |
| sd_(Intercept).mother_pidlink | 0.2296 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9731 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 37333 | 37415 | -18655 | 37311 | NA | NA | NA |
| 12 | 37335 | 37425 | -18655 | 37311 | 0.07863 | 1 | 0.7792 |
| 16 | 37335 | 37454 | -18651 | 37303 | 8.196 | 4 | 0.08467 |
| 26 | 37343 | 37538 | -18646 | 37291 | 11.41 | 10 | 0.3267 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3396 | 0.4556 | 0.7455 | -0.5533 | 1.233 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.02374 | 0.05163 | -0.4598 | -0.1249 | 0.07745 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0004681 | 0.00184 | 0.2544 | -0.003139 | 0.004075 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000000806 | 0.00002081 | -0.03873 | -0.00004159 | 0.00003998 | fixed |
| male | -0.1672 | 0.02673 | -6.254 | -0.2195 | -0.1148 | fixed |
| sibling_count3 | -0.03185 | 0.04119 | -0.7732 | -0.1126 | 0.04888 | fixed |
| sibling_count4 | -0.03044 | 0.04426 | -0.6878 | -0.1172 | 0.0563 | fixed |
| sibling_count5 | -0.08456 | 0.05032 | -1.681 | -0.1832 | 0.01405 | fixed |
| sibling_count5+ | 0.009297 | 0.0441 | 0.2108 | -0.07714 | 0.09573 | fixed |
| sd_(Intercept).mother_pidlink | 0.2758 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9621 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3493 | 0.4557 | 0.7667 | -0.5437 | 1.242 | fixed |
| birth_order | -0.009249 | 0.008842 | -1.046 | -0.02658 | 0.008081 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.02359 | 0.05163 | -0.457 | -0.1248 | 0.0776 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0004791 | 0.00184 | 0.2604 | -0.003128 | 0.004086 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001283 | 0.00002082 | -0.06164 | -0.00004208 | 0.00003951 | fixed |
| male | -0.1669 | 0.02673 | -6.242 | -0.2192 | -0.1145 | fixed |
| sibling_count3 | -0.02735 | 0.04141 | -0.6605 | -0.1085 | 0.05381 | fixed |
| sibling_count4 | -0.01989 | 0.04539 | -0.4382 | -0.1089 | 0.06907 | fixed |
| sibling_count5 | -0.06731 | 0.05295 | -1.271 | -0.1711 | 0.03646 | fixed |
| sibling_count5+ | 0.04383 | 0.05509 | 0.7956 | -0.06415 | 0.1518 | fixed |
| sd_(Intercept).mother_pidlink | 0.2755 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9621 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3664 | 0.4564 | 0.8028 | -0.5281 | 1.261 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.025 | 0.05167 | -0.4838 | -0.1263 | 0.07627 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0005214 | 0.001842 | 0.2831 | -0.003088 | 0.004131 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001519 | 0.00002084 | -0.07289 | -0.00004236 | 0.00003932 | fixed |
| male | -0.1672 | 0.02674 | -6.253 | -0.2196 | -0.1148 | fixed |
| sibling_count3 | -0.02176 | 0.04234 | -0.5139 | -0.1047 | 0.06122 | fixed |
| sibling_count4 | -0.006586 | 0.04733 | -0.1392 | -0.09935 | 0.08618 | fixed |
| sibling_count5 | -0.06368 | 0.05586 | -1.14 | -0.1732 | 0.0458 | fixed |
| sibling_count5+ | 0.02303 | 0.05681 | 0.4054 | -0.08831 | 0.1344 | fixed |
| birth_order_nonlinear2 | -0.05137 | 0.03482 | -1.475 | -0.1196 | 0.01689 | fixed |
| birth_order_nonlinear3 | -0.04622 | 0.043 | -1.075 | -0.1305 | 0.03806 | fixed |
| birth_order_nonlinear4 | -0.08107 | 0.05289 | -1.533 | -0.1847 | 0.02259 | fixed |
| birth_order_nonlinear5 | -0.007182 | 0.0664 | -0.1082 | -0.1373 | 0.123 | fixed |
| birth_order_nonlinear5+ | -0.01977 | 0.06609 | -0.2992 | -0.1493 | 0.1098 | fixed |
| sd_(Intercept).mother_pidlink | 0.2752 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9623 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.3036 | 0.4573 | 0.6638 | -0.5928 | 1.2 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.02162 | 0.05178 | -0.4177 | -0.1231 | 0.07986 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0004008 | 0.001846 | 0.2171 | -0.003217 | 0.004019 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000001901 | 0.00002089 | -0.009102 | -0.00004113 | 0.00004075 | fixed |
| male | -0.1674 | 0.02675 | -6.259 | -0.2199 | -0.115 | fixed |
| count_birth_order2/2 | 0.04984 | 0.06253 | 0.7971 | -0.07271 | 0.1724 | fixed |
| count_birth_order1/3 | 0.006794 | 0.05503 | 0.1235 | -0.1011 | 0.1147 | fixed |
| count_birth_order2/3 | -0.04718 | 0.05997 | -0.7867 | -0.1647 | 0.07036 | fixed |
| count_birth_order3/3 | -0.01196 | 0.06727 | -0.1777 | -0.1438 | 0.1199 | fixed |
| count_birth_order1/4 | 0.08962 | 0.06745 | 1.329 | -0.04258 | 0.2218 | fixed |
| count_birth_order2/4 | -0.02104 | 0.06994 | -0.3008 | -0.1581 | 0.116 | fixed |
| count_birth_order3/4 | -0.05884 | 0.07375 | -0.7979 | -0.2034 | 0.08571 | fixed |
| count_birth_order4/4 | -0.1026 | 0.07623 | -1.346 | -0.252 | 0.04683 | fixed |
| count_birth_order1/5 | 0.06434 | 0.09266 | 0.6944 | -0.1173 | 0.2459 | fixed |
| count_birth_order2/5 | -0.2541 | 0.09733 | -2.61 | -0.4448 | -0.0633 | fixed |
| count_birth_order3/5 | -0.03349 | 0.09129 | -0.3669 | -0.2124 | 0.1454 | fixed |
| count_birth_order4/5 | -0.06889 | 0.08782 | -0.7845 | -0.241 | 0.1032 | fixed |
| count_birth_order5/5 | -0.06955 | 0.09262 | -0.751 | -0.2511 | 0.112 | fixed |
| count_birth_order1/5+ | 0.02715 | 0.09171 | 0.296 | -0.1526 | 0.2069 | fixed |
| count_birth_order2/5+ | 0.001829 | 0.08961 | 0.02042 | -0.1738 | 0.1775 | fixed |
| count_birth_order3/5+ | -0.01085 | 0.09033 | -0.1202 | -0.1879 | 0.1662 | fixed |
| count_birth_order4/5+ | -0.0006068 | 0.08483 | -0.007153 | -0.1669 | 0.1657 | fixed |
| count_birth_order5/5+ | 0.0725 | 0.08009 | 0.9052 | -0.08447 | 0.2295 | fixed |
| count_birth_order5+/5+ | 0.03753 | 0.06005 | 0.6249 | -0.08017 | 0.1552 | fixed |
| sd_(Intercept).mother_pidlink | 0.2766 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9618 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 15913 | 15986 | -7946 | 15891 | NA | NA | NA |
| 12 | 15914 | 15994 | -7945 | 15890 | 1.097 | 1 | 0.295 |
| 16 | 15919 | 16025 | -7944 | 15887 | 2.96 | 4 | 0.5645 |
| 26 | 15928 | 16100 | -7938 | 15876 | 11.33 | 10 | 0.3327 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2803 | 0.4549 | 0.6161 | -0.6114 | 1.172 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01659 | 0.05158 | -0.3216 | -0.1177 | 0.0845 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0002559 | 0.001839 | 0.1392 | -0.003348 | 0.00386 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00000142 | 0.0000208 | 0.06829 | -0.00003934 | 0.00004218 | fixed |
| male | -0.1677 | 0.02666 | -6.29 | -0.22 | -0.1154 | fixed |
| sibling_count3 | -0.03632 | 0.04461 | -0.8141 | -0.1238 | 0.05112 | fixed |
| sibling_count4 | -0.05024 | 0.04695 | -1.07 | -0.1423 | 0.04178 | fixed |
| sibling_count5 | -0.09453 | 0.05008 | -1.888 | -0.1927 | 0.003625 | fixed |
| sibling_count5+ | -0.042 | 0.0439 | -0.9567 | -0.1281 | 0.04405 | fixed |
| sd_(Intercept).mother_pidlink | 0.2763 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9639 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2852 | 0.4551 | 0.6268 | -0.6067 | 1.177 | fixed |
| birth_order | -0.003693 | 0.007719 | -0.4785 | -0.01882 | 0.01144 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01666 | 0.05158 | -0.3229 | -0.1178 | 0.08444 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0002648 | 0.001839 | 0.144 | -0.00334 | 0.003869 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000001181 | 0.00002081 | 0.05676 | -0.0000396 | 0.00004196 | fixed |
| male | -0.1676 | 0.02666 | -6.286 | -0.2199 | -0.1154 | fixed |
| sibling_count3 | -0.03454 | 0.04477 | -0.7715 | -0.1223 | 0.05321 | fixed |
| sibling_count4 | -0.04624 | 0.04769 | -0.9694 | -0.1397 | 0.04724 | fixed |
| sibling_count5 | -0.08819 | 0.0518 | -1.702 | -0.1897 | 0.01335 | fixed |
| sibling_count5+ | -0.02854 | 0.05215 | -0.5472 | -0.1307 | 0.07367 | fixed |
| sd_(Intercept).mother_pidlink | 0.2765 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9639 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2935 | 0.4557 | 0.644 | -0.5997 | 1.187 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01693 | 0.05161 | -0.328 | -0.1181 | 0.08423 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0002759 | 0.00184 | 0.1499 | -0.003331 | 0.003883 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000001077 | 0.00002082 | 0.05174 | -0.00003973 | 0.00004189 | fixed |
| male | -0.1677 | 0.02667 | -6.286 | -0.2199 | -0.1154 | fixed |
| sibling_count3 | -0.02672 | 0.04564 | -0.5854 | -0.1162 | 0.06273 | fixed |
| sibling_count4 | -0.03366 | 0.04946 | -0.6806 | -0.1306 | 0.06327 | fixed |
| sibling_count5 | -0.09006 | 0.05445 | -1.654 | -0.1968 | 0.01666 | fixed |
| sibling_count5+ | -0.02947 | 0.05386 | -0.5472 | -0.135 | 0.07609 | fixed |
| birth_order_nonlinear2 | -0.03417 | 0.03546 | -0.9636 | -0.1037 | 0.03533 | fixed |
| birth_order_nonlinear3 | -0.04388 | 0.04294 | -1.022 | -0.128 | 0.04028 | fixed |
| birth_order_nonlinear4 | -0.04532 | 0.05141 | -0.8815 | -0.1461 | 0.05545 | fixed |
| birth_order_nonlinear5 | 0.04514 | 0.06348 | 0.7111 | -0.07927 | 0.1695 | fixed |
| birth_order_nonlinear5+ | -0.03754 | 0.05897 | -0.6366 | -0.1531 | 0.07803 | fixed |
| sd_(Intercept).mother_pidlink | 0.2754 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9643 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2458 | 0.4564 | 0.5387 | -0.6487 | 1.14 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01502 | 0.05167 | -0.2908 | -0.1163 | 0.08624 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0002208 | 0.001843 | 0.1199 | -0.00339 | 0.003832 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000001544 | 0.00002085 | 0.07404 | -0.00003932 | 0.00004241 | fixed |
| male | -0.1686 | 0.02668 | -6.318 | -0.2208 | -0.1163 | fixed |
| count_birth_order2/2 | 0.05091 | 0.06853 | 0.7429 | -0.0834 | 0.1852 | fixed |
| count_birth_order1/3 | -0.02987 | 0.05958 | -0.5013 | -0.1466 | 0.08691 | fixed |
| count_birth_order2/3 | -0.01262 | 0.06455 | -0.1955 | -0.1391 | 0.1139 | fixed |
| count_birth_order3/3 | -0.0074 | 0.07288 | -0.1015 | -0.1502 | 0.1354 | fixed |
| count_birth_order1/4 | 0.008093 | 0.07064 | 0.1146 | -0.1304 | 0.1465 | fixed |
| count_birth_order2/4 | -0.04846 | 0.07154 | -0.6775 | -0.1887 | 0.09175 | fixed |
| count_birth_order3/4 | -0.0728 | 0.07947 | -0.9161 | -0.2286 | 0.08295 | fixed |
| count_birth_order4/4 | -0.03101 | 0.08154 | -0.3803 | -0.1908 | 0.1288 | fixed |
| count_birth_order1/5 | 0.03524 | 0.08409 | 0.419 | -0.1296 | 0.2001 | fixed |
| count_birth_order2/5 | -0.2036 | 0.08988 | -2.266 | -0.3798 | -0.02747 | fixed |
| count_birth_order3/5 | -0.06839 | 0.08811 | -0.7762 | -0.2411 | 0.1043 | fixed |
| count_birth_order4/5 | -0.05163 | 0.08975 | -0.5752 | -0.2275 | 0.1243 | fixed |
| count_birth_order5/5 | -0.1248 | 0.09141 | -1.366 | -0.304 | 0.05434 | fixed |
| count_birth_order1/5+ | 0.05525 | 0.08032 | 0.6879 | -0.1022 | 0.2127 | fixed |
| count_birth_order2/5+ | -0.06272 | 0.08338 | -0.7522 | -0.2261 | 0.1007 | fixed |
| count_birth_order3/5+ | -0.09434 | 0.08161 | -1.156 | -0.2543 | 0.0656 | fixed |
| count_birth_order4/5+ | -0.102 | 0.07863 | -1.298 | -0.2562 | 0.05205 | fixed |
| count_birth_order5/5+ | 0.1224 | 0.08125 | 1.506 | -0.03689 | 0.2816 | fixed |
| count_birth_order5+/5+ | -0.03842 | 0.05877 | -0.6537 | -0.1536 | 0.07676 | fixed |
| sd_(Intercept).mother_pidlink | 0.2758 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.964 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 16083 | 16156 | -8030 | 16061 | NA | NA | NA |
| 12 | 16084 | 16164 | -8030 | 16060 | 0.2292 | 1 | 0.6322 |
| 16 | 16089 | 16195 | -8029 | 16057 | 3.265 | 4 | 0.5144 |
| 26 | 16097 | 16269 | -8022 | 16045 | 12.57 | 10 | 0.2489 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2561 | 0.461 | 0.5554 | -0.6476 | 1.16 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01302 | 0.05228 | -0.2492 | -0.1155 | 0.08943 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00007644 | 0.001864 | 0.04101 | -0.003577 | 0.00373 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000003881 | 0.00002109 | 0.184 | -0.00003746 | 0.00004522 | fixed |
| male | -0.1655 | 0.02702 | -6.125 | -0.2184 | -0.1125 | fixed |
| sibling_count3 | -0.0656 | 0.04068 | -1.613 | -0.1453 | 0.01413 | fixed |
| sibling_count4 | -0.05115 | 0.04402 | -1.162 | -0.1374 | 0.03512 | fixed |
| sibling_count5 | -0.07579 | 0.05159 | -1.469 | -0.1769 | 0.02532 | fixed |
| sibling_count5+ | -0.005087 | 0.04459 | -0.1141 | -0.09248 | 0.08231 | fixed |
| sd_(Intercept).mother_pidlink | 0.2768 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.962 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2668 | 0.4611 | 0.5787 | -0.6369 | 1.171 | fixed |
| birth_order | -0.01188 | 0.009134 | -1.301 | -0.02978 | 0.006021 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01267 | 0.05227 | -0.2423 | -0.1151 | 0.08979 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0000857 | 0.001864 | 0.04598 | -0.003568 | 0.003739 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000003318 | 0.0000211 | 0.1573 | -0.00003803 | 0.00004467 | fixed |
| male | -0.1653 | 0.02702 | -6.12 | -0.2183 | -0.1124 | fixed |
| sibling_count3 | -0.05985 | 0.04091 | -1.463 | -0.14 | 0.02033 | fixed |
| sibling_count4 | -0.03784 | 0.04519 | -0.8374 | -0.1264 | 0.05073 | fixed |
| sibling_count5 | -0.05463 | 0.05408 | -1.01 | -0.1606 | 0.05137 | fixed |
| sibling_count5+ | 0.03887 | 0.05595 | 0.6946 | -0.0708 | 0.1485 | fixed |
| sd_(Intercept).mother_pidlink | 0.2761 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9621 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2832 | 0.4616 | 0.6135 | -0.6216 | 1.188 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01419 | 0.0523 | -0.2714 | -0.1167 | 0.08831 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001259 | 0.001865 | 0.06749 | -0.003529 | 0.003781 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000003223 | 0.00002111 | 0.1527 | -0.00003815 | 0.0000446 | fixed |
| male | -0.1654 | 0.02702 | -6.122 | -0.2184 | -0.1125 | fixed |
| sibling_count3 | -0.05455 | 0.04185 | -1.303 | -0.1366 | 0.02748 | fixed |
| sibling_count4 | -0.01928 | 0.04716 | -0.4089 | -0.1117 | 0.07316 | fixed |
| sibling_count5 | -0.04379 | 0.05679 | -0.7711 | -0.1551 | 0.06751 | fixed |
| sibling_count5+ | 0.01121 | 0.05776 | 0.1942 | -0.102 | 0.1244 | fixed |
| birth_order_nonlinear2 | -0.05398 | 0.03475 | -1.553 | -0.1221 | 0.01413 | fixed |
| birth_order_nonlinear3 | -0.0535 | 0.04299 | -1.244 | -0.1378 | 0.03076 | fixed |
| birth_order_nonlinear4 | -0.1149 | 0.05453 | -2.108 | -0.2218 | -0.008062 | fixed |
| birth_order_nonlinear5 | -0.02809 | 0.06932 | -0.4053 | -0.164 | 0.1078 | fixed |
| birth_order_nonlinear5+ | -0.007244 | 0.06824 | -0.1062 | -0.141 | 0.1265 | fixed |
| sd_(Intercept).mother_pidlink | 0.2768 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9619 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2345 | 0.4627 | 0.5068 | -0.6724 | 1.141 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01171 | 0.05242 | -0.2233 | -0.1145 | 0.09104 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00003515 | 0.00187 | 0.0188 | -0.00363 | 0.0037 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000004257 | 0.00002117 | 0.2011 | -0.00003723 | 0.00004575 | fixed |
| male | -0.1653 | 0.02704 | -6.112 | -0.2183 | -0.1123 | fixed |
| count_birth_order2/2 | 0.02629 | 0.06095 | 0.4313 | -0.09317 | 0.1457 | fixed |
| count_birth_order1/3 | -0.03493 | 0.05433 | -0.6428 | -0.1414 | 0.07156 | fixed |
| count_birth_order2/3 | -0.1016 | 0.06005 | -1.692 | -0.2193 | 0.01611 | fixed |
| count_birth_order3/3 | -0.03764 | 0.06607 | -0.5697 | -0.1671 | 0.09185 | fixed |
| count_birth_order1/4 | 0.0777 | 0.06782 | 1.146 | -0.05522 | 0.2106 | fixed |
| count_birth_order2/4 | -0.02365 | 0.0699 | -0.3383 | -0.1607 | 0.1134 | fixed |
| count_birth_order3/4 | -0.1102 | 0.0729 | -1.511 | -0.2531 | 0.03273 | fixed |
| count_birth_order4/4 | -0.161 | 0.07707 | -2.089 | -0.312 | -0.009911 | fixed |
| count_birth_order1/5 | 0.03346 | 0.09249 | 0.3618 | -0.1478 | 0.2147 | fixed |
| count_birth_order2/5 | -0.2067 | 0.1004 | -2.058 | -0.4035 | -0.009846 | fixed |
| count_birth_order3/5 | -0.05244 | 0.09566 | -0.5482 | -0.2399 | 0.135 | fixed |
| count_birth_order4/5 | -0.0368 | 0.09232 | -0.3986 | -0.2177 | 0.1441 | fixed |
| count_birth_order5/5 | -0.1015 | 0.09907 | -1.025 | -0.2957 | 0.09264 | fixed |
| count_birth_order1/5+ | 0.01973 | 0.09445 | 0.2089 | -0.1654 | 0.2049 | fixed |
| count_birth_order2/5+ | -0.03106 | 0.09154 | -0.3393 | -0.2105 | 0.1483 | fixed |
| count_birth_order3/5+ | -0.01469 | 0.09151 | -0.1605 | -0.1941 | 0.1647 | fixed |
| count_birth_order4/5+ | -0.08713 | 0.0892 | -0.9768 | -0.262 | 0.0877 | fixed |
| count_birth_order5/5+ | 0.04642 | 0.08218 | 0.5649 | -0.1147 | 0.2075 | fixed |
| count_birth_order5+/5+ | 0.03171 | 0.06116 | 0.5185 | -0.08816 | 0.1516 | fixed |
| sd_(Intercept).mother_pidlink | 0.2777 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9616 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 15595 | 15668 | -7786 | 15573 | NA | NA | NA |
| 12 | 15595 | 15675 | -7786 | 15571 | 1.697 | 1 | 0.1927 |
| 16 | 15599 | 15704 | -7783 | 15567 | 4.548 | 4 | 0.337 |
| 26 | 15608 | 15780 | -7778 | 15556 | 10.68 | 10 | 0.3827 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = years_of_education_z)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.688 | 0.1288 | -20.87 | -2.941 | -2.436 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2633 | 0.01224 | 21.51 | 0.2393 | 0.2873 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006974 | 0.0003591 | -19.42 | -0.007678 | -0.00627 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005177 | 0.000003294 | 15.71 | 0.00004531 | 0.00005823 | fixed |
| male | -0.02813 | 0.013 | -2.163 | -0.05362 | -0.002644 | fixed |
| sibling_count3 | 0.07051 | 0.03368 | 2.093 | 0.004496 | 0.1365 | fixed |
| sibling_count4 | 0.0338 | 0.03529 | 0.9576 | -0.03538 | 0.103 | fixed |
| sibling_count5 | 0.02754 | 0.0374 | 0.7364 | -0.04577 | 0.1008 | fixed |
| sibling_count5+ | -0.2199 | 0.02876 | -7.648 | -0.2763 | -0.1636 | fixed |
| sd_(Intercept).mother_pidlink | 0.6782 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.6413 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.696 | 0.1288 | -20.93 | -2.949 | -2.444 | fixed |
| birth_order | 0.006501 | 0.002997 | 2.169 | 0.0006277 | 0.01237 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2614 | 0.01227 | 21.3 | 0.2373 | 0.2854 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006884 | 0.0003615 | -19.04 | -0.007592 | -0.006175 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005089 | 0.00000332 | 15.33 | 0.00004438 | 0.00005739 | fixed |
| male | -0.0283 | 0.013 | -2.177 | -0.05378 | -0.002824 | fixed |
| sibling_count3 | 0.07026 | 0.0337 | 2.085 | 0.004219 | 0.1363 | fixed |
| sibling_count4 | 0.0308 | 0.03534 | 0.8716 | -0.03846 | 0.1001 | fixed |
| sibling_count5 | 0.02083 | 0.03755 | 0.5546 | -0.05277 | 0.09442 | fixed |
| sibling_count5+ | -0.2435 | 0.03076 | -7.917 | -0.3038 | -0.1832 | fixed |
| sd_(Intercept).mother_pidlink | 0.6792 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.6407 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.665 | 0.1291 | -20.64 | -2.918 | -2.411 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2613 | 0.01227 | 21.31 | 0.2373 | 0.2854 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006871 | 0.0003613 | -19.02 | -0.007579 | -0.006163 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005046 | 0.000003321 | 15.2 | 0.00004396 | 0.00005697 | fixed |
| male | -0.02841 | 0.01299 | -2.188 | -0.05386 | -0.002961 | fixed |
| sibling_count3 | 0.08287 | 0.03392 | 2.443 | 0.01639 | 0.1494 | fixed |
| sibling_count4 | 0.05735 | 0.0358 | 1.602 | -0.01282 | 0.1275 | fixed |
| sibling_count5 | 0.05175 | 0.03825 | 1.353 | -0.02322 | 0.1267 | fixed |
| sibling_count5+ | -0.2166 | 0.03162 | -6.85 | -0.2786 | -0.1546 | fixed |
| birth_order_nonlinear2 | -0.04969 | 0.01841 | -2.698 | -0.08578 | -0.0136 | fixed |
| birth_order_nonlinear3 | -0.07061 | 0.02142 | -3.296 | -0.1126 | -0.02862 | fixed |
| birth_order_nonlinear4 | -0.08076 | 0.02452 | -3.293 | -0.1288 | -0.03269 | fixed |
| birth_order_nonlinear5 | -0.02921 | 0.02787 | -1.048 | -0.08383 | 0.02541 | fixed |
| birth_order_nonlinear5+ | 0.0102 | 0.02471 | 0.4128 | -0.03823 | 0.05863 | fixed |
| sd_(Intercept).mother_pidlink | 0.6799 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.6398 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.655 | 0.1297 | -20.47 | -2.909 | -2.401 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.261 | 0.01227 | 21.27 | 0.237 | 0.2851 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006856 | 0.0003615 | -18.96 | -0.007565 | -0.006147 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005029 | 0.000003325 | 15.12 | 0.00004377 | 0.00005681 | fixed |
| male | -0.02811 | 0.01299 | -2.165 | -0.05357 | -0.002659 | fixed |
| count_birth_order2/2 | -0.07379 | 0.03615 | -2.041 | -0.1446 | -0.002938 | fixed |
| count_birth_order1/3 | 0.07773 | 0.03991 | 1.948 | -0.0004907 | 0.156 | fixed |
| count_birth_order2/3 | 0.01959 | 0.04385 | 0.4469 | -0.06635 | 0.1055 | fixed |
| count_birth_order3/3 | 0.004158 | 0.04807 | 0.08651 | -0.09005 | 0.09837 | fixed |
| count_birth_order1/4 | 0.03963 | 0.04447 | 0.8911 | -0.04753 | 0.1268 | fixed |
| count_birth_order2/4 | -0.01847 | 0.04706 | -0.3925 | -0.1107 | 0.07377 | fixed |
| count_birth_order3/4 | -0.003081 | 0.0501 | -0.0615 | -0.1013 | 0.09511 | fixed |
| count_birth_order4/4 | -0.006753 | 0.05219 | -0.1294 | -0.109 | 0.09554 | fixed |
| count_birth_order1/5 | 0.03106 | 0.05016 | 0.6191 | -0.06726 | 0.1294 | fixed |
| count_birth_order2/5 | 0.004568 | 0.05248 | 0.08705 | -0.09828 | 0.1074 | fixed |
| count_birth_order3/5 | -0.09389 | 0.05304 | -1.77 | -0.1978 | 0.01008 | fixed |
| count_birth_order4/5 | -0.04342 | 0.05613 | -0.7736 | -0.1534 | 0.06658 | fixed |
| count_birth_order5/5 | 0.1147 | 0.0571 | 2.008 | 0.00277 | 0.2266 | fixed |
| count_birth_order1/5+ | -0.2286 | 0.0397 | -5.758 | -0.3064 | -0.1508 | fixed |
| count_birth_order2/5+ | -0.2492 | 0.04077 | -6.112 | -0.3291 | -0.1693 | fixed |
| count_birth_order3/5+ | -0.2759 | 0.03996 | -6.904 | -0.3542 | -0.1976 | fixed |
| count_birth_order4/5+ | -0.3126 | 0.03947 | -7.919 | -0.3899 | -0.2352 | fixed |
| count_birth_order5/5+ | -0.2873 | 0.03954 | -7.266 | -0.3648 | -0.2098 | fixed |
| count_birth_order5+/5+ | -0.2149 | 0.03384 | -6.349 | -0.2812 | -0.1485 | fixed |
| sd_(Intercept).mother_pidlink | 0.6799 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.6397 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 36298 | 36381 | -18138 | 36276 | NA | NA | NA |
| 12 | 36295 | 36386 | -18136 | 36271 | 4.685 | 1 | 0.03043 |
| 16 | 36281 | 36402 | -18125 | 36249 | 22.33 | 4 | 0.0001724 |
| 26 | 36288 | 36485 | -18118 | 36236 | 13.46 | 10 | 0.1991 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.736 | 0.309 | -21.8 | -7.342 | -6.13 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7187 | 0.03506 | 20.5 | 0.65 | 0.7874 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02238 | 0.001252 | -17.87 | -0.02483 | -0.01993 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002241 | 0.0000142 | 15.78 | 0.0001963 | 0.000252 | fixed |
| male | -0.07737 | 0.0178 | -4.347 | -0.1123 | -0.04248 | fixed |
| sibling_count3 | 0.01365 | 0.03226 | 0.423 | -0.04959 | 0.07688 | fixed |
| sibling_count4 | -0.08132 | 0.03529 | -2.304 | -0.1505 | -0.01215 | fixed |
| sibling_count5 | -0.1649 | 0.04105 | -4.017 | -0.2454 | -0.08447 | fixed |
| sibling_count5+ | -0.3901 | 0.03602 | -10.83 | -0.4607 | -0.3195 | fixed |
| sd_(Intercept).mother_pidlink | 0.5155 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.5677 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.749 | 0.3088 | -21.86 | -7.354 | -6.144 | fixed |
| birth_order | 0.01624 | 0.006102 | 2.662 | 0.004285 | 0.0282 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7172 | 0.03504 | 20.47 | 0.6485 | 0.7858 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02234 | 0.001251 | -17.85 | -0.02479 | -0.01988 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002243 | 0.00001419 | 15.81 | 0.0001965 | 0.0002522 | fixed |
| male | -0.07822 | 0.01779 | -4.398 | -0.1131 | -0.04336 | fixed |
| sibling_count3 | 0.004941 | 0.03243 | 0.1524 | -0.05863 | 0.06851 | fixed |
| sibling_count4 | -0.1021 | 0.03616 | -2.824 | -0.173 | -0.03126 | fixed |
| sibling_count5 | -0.198 | 0.04291 | -4.615 | -0.2821 | -0.1139 | fixed |
| sibling_count5+ | -0.4559 | 0.04371 | -10.43 | -0.5415 | -0.3702 | fixed |
| sd_(Intercept).mother_pidlink | 0.5166 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.5667 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.665 | 0.3096 | -21.53 | -7.271 | -6.058 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.712 | 0.03506 | 20.31 | 0.6433 | 0.7808 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02217 | 0.001252 | -17.71 | -0.02462 | -0.01971 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002228 | 0.00001419 | 15.69 | 0.0001949 | 0.0002506 | fixed |
| male | -0.07857 | 0.01776 | -4.425 | -0.1134 | -0.04377 | fixed |
| sibling_count3 | 0.005269 | 0.03283 | 0.1605 | -0.05908 | 0.06962 | fixed |
| sibling_count4 | -0.1132 | 0.03708 | -3.054 | -0.1859 | -0.04056 | fixed |
| sibling_count5 | -0.2355 | 0.04429 | -5.317 | -0.3223 | -0.1487 | fixed |
| sibling_count5+ | -0.4792 | 0.04459 | -10.74 | -0.5666 | -0.3918 | fixed |
| birth_order_nonlinear2 | -0.05353 | 0.02201 | -2.433 | -0.09667 | -0.0104 | fixed |
| birth_order_nonlinear3 | 0.02796 | 0.02736 | 1.022 | -0.02568 | 0.08159 | fixed |
| birth_order_nonlinear4 | 0.0843 | 0.03424 | 2.462 | 0.01719 | 0.1514 | fixed |
| birth_order_nonlinear5 | 0.1608 | 0.04246 | 3.786 | 0.07755 | 0.244 | fixed |
| birth_order_nonlinear5+ | 0.07327 | 0.04454 | 1.645 | -0.01403 | 0.1606 | fixed |
| sd_(Intercept).mother_pidlink | 0.5157 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.5657 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.676 | 0.3105 | -21.5 | -7.285 | -6.067 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.713 | 0.03516 | 20.28 | 0.6441 | 0.7819 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02222 | 0.001256 | -17.69 | -0.02468 | -0.01976 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002235 | 0.00001424 | 15.69 | 0.0001955 | 0.0002514 | fixed |
| male | -0.07799 | 0.01778 | -4.386 | -0.1128 | -0.04314 | fixed |
| count_birth_order2/2 | -0.03586 | 0.04032 | -0.8893 | -0.1149 | 0.04317 | fixed |
| count_birth_order1/3 | 0.03154 | 0.03934 | 0.8017 | -0.04557 | 0.1087 | fixed |
| count_birth_order2/3 | -0.06423 | 0.04233 | -1.517 | -0.1472 | 0.01873 | fixed |
| count_birth_order3/3 | 0.02724 | 0.04677 | 0.5824 | -0.06443 | 0.1189 | fixed |
| count_birth_order1/4 | -0.1151 | 0.0475 | -2.423 | -0.2082 | -0.02198 | fixed |
| count_birth_order2/4 | -0.1695 | 0.04852 | -3.495 | -0.2646 | -0.07446 | fixed |
| count_birth_order3/4 | -0.0516 | 0.05091 | -1.014 | -0.1514 | 0.04818 | fixed |
| count_birth_order4/4 | -0.03001 | 0.05286 | -0.5676 | -0.1336 | 0.0736 | fixed |
| count_birth_order1/5 | -0.2277 | 0.06389 | -3.564 | -0.3529 | -0.1025 | fixed |
| count_birth_order2/5 | -0.2326 | 0.06767 | -3.437 | -0.3652 | -0.09994 | fixed |
| count_birth_order3/5 | -0.2085 | 0.06323 | -3.297 | -0.3324 | -0.08455 | fixed |
| count_birth_order4/5 | -0.1802 | 0.06188 | -2.912 | -0.3015 | -0.05892 | fixed |
| count_birth_order5/5 | -0.06835 | 0.06392 | -1.069 | -0.1936 | 0.05694 | fixed |
| count_birth_order1/5+ | -0.5118 | 0.06239 | -8.204 | -0.6341 | -0.3895 | fixed |
| count_birth_order2/5+ | -0.5145 | 0.06185 | -8.319 | -0.6357 | -0.3933 | fixed |
| count_birth_order3/5+ | -0.4626 | 0.0607 | -7.622 | -0.5816 | -0.3437 | fixed |
| count_birth_order4/5+ | -0.351 | 0.05758 | -6.095 | -0.4638 | -0.2381 | fixed |
| count_birth_order5/5+ | -0.3139 | 0.05473 | -5.734 | -0.4211 | -0.2066 | fixed |
| count_birth_order5+/5+ | -0.3993 | 0.04395 | -9.085 | -0.4854 | -0.3132 | fixed |
| sd_(Intercept).mother_pidlink | 0.5154 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.5662 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 13603 | 13677 | -6790 | 13581 | NA | NA | NA |
| 12 | 13598 | 13678 | -6787 | 13574 | 7.074 | 1 | 0.007821 |
| 16 | 13581 | 13688 | -6774 | 13549 | 24.75 | 4 | 0.00005645 |
| 26 | 13596 | 13771 | -6772 | 13544 | 4.93 | 10 | 0.8958 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.746 | 0.3083 | -21.88 | -7.351 | -6.142 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7193 | 0.035 | 20.55 | 0.6507 | 0.7879 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02245 | 0.00125 | -17.96 | -0.0249 | -0.02 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002249 | 0.00001418 | 15.85 | 0.0001971 | 0.0002526 | fixed |
| male | -0.07773 | 0.01774 | -4.381 | -0.1125 | -0.04296 | fixed |
| sibling_count3 | 0.0339 | 0.03494 | 0.9704 | -0.03457 | 0.1024 | fixed |
| sibling_count4 | -0.03127 | 0.03721 | -0.8404 | -0.1042 | 0.04166 | fixed |
| sibling_count5 | -0.08928 | 0.04042 | -2.209 | -0.1685 | -0.01006 | fixed |
| sibling_count5+ | -0.2673 | 0.03522 | -7.589 | -0.3363 | -0.1983 | fixed |
| sd_(Intercept).mother_pidlink | 0.5206 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.5663 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.75 | 0.3084 | -21.89 | -7.354 | -6.145 | fixed |
| birth_order | 0.003115 | 0.005405 | 0.5763 | -0.007478 | 0.01371 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7191 | 0.035 | 20.55 | 0.6505 | 0.7877 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02245 | 0.00125 | -17.96 | -0.0249 | -0.02 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002249 | 0.00001418 | 15.86 | 0.0001971 | 0.0002527 | fixed |
| male | -0.07789 | 0.01774 | -4.39 | -0.1127 | -0.04311 | fixed |
| sibling_count3 | 0.03222 | 0.03507 | 0.9189 | -0.03651 | 0.101 | fixed |
| sibling_count4 | -0.03509 | 0.0378 | -0.9283 | -0.1092 | 0.039 | fixed |
| sibling_count5 | -0.09522 | 0.04172 | -2.282 | -0.177 | -0.01344 | fixed |
| sibling_count5+ | -0.2794 | 0.04103 | -6.809 | -0.3598 | -0.199 | fixed |
| sd_(Intercept).mother_pidlink | 0.521 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.5661 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.671 | 0.3092 | -21.57 | -7.277 | -6.065 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7127 | 0.03503 | 20.34 | 0.6441 | 0.7814 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02222 | 0.001251 | -17.76 | -0.02467 | -0.01977 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002226 | 0.00001419 | 15.68 | 0.0001948 | 0.0002504 | fixed |
| male | -0.07837 | 0.01773 | -4.421 | -0.1131 | -0.04362 | fixed |
| sibling_count3 | 0.03597 | 0.03548 | 1.014 | -0.03356 | 0.1055 | fixed |
| sibling_count4 | -0.03978 | 0.0387 | -1.028 | -0.1156 | 0.03606 | fixed |
| sibling_count5 | -0.1169 | 0.04304 | -2.716 | -0.2013 | -0.03254 | fixed |
| sibling_count5+ | -0.2918 | 0.04193 | -6.96 | -0.374 | -0.2096 | fixed |
| birth_order_nonlinear2 | -0.05895 | 0.02256 | -2.613 | -0.1032 | -0.01474 | fixed |
| birth_order_nonlinear3 | -0.01423 | 0.0274 | -0.5195 | -0.06793 | 0.03946 | fixed |
| birth_order_nonlinear4 | 0.03769 | 0.03338 | 1.129 | -0.02773 | 0.1031 | fixed |
| birth_order_nonlinear5 | 0.0732 | 0.04067 | 1.8 | -0.006512 | 0.1529 | fixed |
| birth_order_nonlinear5+ | -0.01079 | 0.04033 | -0.2675 | -0.08984 | 0.06826 | fixed |
| sd_(Intercept).mother_pidlink | 0.5208 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.5654 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.652 | 0.3102 | -21.44 | -7.26 | -6.044 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7099 | 0.03512 | 20.22 | 0.6411 | 0.7788 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02212 | 0.001255 | -17.63 | -0.02458 | -0.01966 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002213 | 0.00001423 | 15.55 | 0.0001934 | 0.0002492 | fixed |
| male | -0.07904 | 0.01775 | -4.453 | -0.1138 | -0.04425 | fixed |
| count_birth_order2/2 | -0.04672 | 0.0446 | -1.048 | -0.1341 | 0.04069 | fixed |
| count_birth_order1/3 | 0.05622 | 0.04275 | 1.315 | -0.02757 | 0.14 | fixed |
| count_birth_order2/3 | -0.05503 | 0.04603 | -1.196 | -0.1452 | 0.03518 | fixed |
| count_birth_order3/3 | 0.04289 | 0.05079 | 0.8444 | -0.05666 | 0.1424 | fixed |
| count_birth_order1/4 | -0.07165 | 0.04984 | -1.438 | -0.1693 | 0.02603 | fixed |
| count_birth_order2/4 | -0.05084 | 0.05034 | -1.01 | -0.1495 | 0.04782 | fixed |
| count_birth_order3/4 | -0.06351 | 0.0545 | -1.165 | -0.1703 | 0.0433 | fixed |
| count_birth_order4/4 | 0.009664 | 0.0564 | 0.1713 | -0.1009 | 0.1202 | fixed |
| count_birth_order1/5 | -0.1223 | 0.05889 | -2.077 | -0.2377 | -0.006873 | fixed |
| count_birth_order2/5 | -0.1555 | 0.06209 | -2.504 | -0.2772 | -0.03379 | fixed |
| count_birth_order3/5 | -0.1429 | 0.06084 | -2.349 | -0.2621 | -0.02364 | fixed |
| count_birth_order4/5 | -0.09629 | 0.06301 | -1.528 | -0.2198 | 0.02721 | fixed |
| count_birth_order5/5 | -0.007981 | 0.06277 | -0.1271 | -0.131 | 0.1151 | fixed |
| count_birth_order1/5+ | -0.2597 | 0.05562 | -4.669 | -0.3687 | -0.1507 | fixed |
| count_birth_order2/5+ | -0.3699 | 0.05726 | -6.461 | -0.4822 | -0.2577 | fixed |
| count_birth_order3/5+ | -0.2976 | 0.05583 | -5.33 | -0.407 | -0.1881 | fixed |
| count_birth_order4/5+ | -0.2436 | 0.05381 | -4.526 | -0.3491 | -0.1381 | fixed |
| count_birth_order5/5+ | -0.2379 | 0.05508 | -4.318 | -0.3458 | -0.1299 | fixed |
| count_birth_order5+/5+ | -0.2999 | 0.04319 | -6.943 | -0.3845 | -0.2152 | fixed |
| sd_(Intercept).mother_pidlink | 0.52 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.5661 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 13753 | 13827 | -6866 | 13731 | NA | NA | NA |
| 12 | 13755 | 13836 | -6865 | 13731 | 0.3298 | 1 | 0.5658 |
| 16 | 13747 | 13855 | -6857 | 13715 | 16.17 | 4 | 0.002799 |
| 26 | 13760 | 13935 | -6854 | 13708 | 6.573 | 10 | 0.765 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.758 | 0.313 | -21.59 | -7.371 | -6.144 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7212 | 0.03553 | 20.3 | 0.6516 | 0.7908 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02248 | 0.001269 | -17.72 | -0.02497 | -0.02 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002253 | 0.0000144 | 15.65 | 0.0001971 | 0.0002536 | fixed |
| male | -0.07967 | 0.018 | -4.426 | -0.1149 | -0.04439 | fixed |
| sibling_count3 | 0.007354 | 0.03188 | 0.2306 | -0.05514 | 0.06985 | fixed |
| sibling_count4 | -0.06524 | 0.03511 | -1.858 | -0.1341 | 0.00357 | fixed |
| sibling_count5 | -0.1584 | 0.04224 | -3.75 | -0.2412 | -0.07564 | fixed |
| sibling_count5+ | -0.3751 | 0.03659 | -10.25 | -0.4469 | -0.3034 | fixed |
| sd_(Intercept).mother_pidlink | 0.5174 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.568 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.769 | 0.3128 | -21.64 | -7.382 | -6.156 | fixed |
| birth_order | 0.01578 | 0.006262 | 2.52 | 0.003506 | 0.02805 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7196 | 0.03551 | 20.26 | 0.65 | 0.7892 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02244 | 0.001268 | -17.69 | -0.02493 | -0.01995 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002255 | 0.00001439 | 15.67 | 0.0001973 | 0.0002538 | fixed |
| male | -0.08017 | 0.01799 | -4.457 | -0.1154 | -0.04492 | fixed |
| sibling_count3 | -0.001263 | 0.03207 | -0.03938 | -0.06412 | 0.06159 | fixed |
| sibling_count4 | -0.08503 | 0.03598 | -2.363 | -0.1555 | -0.01452 | fixed |
| sibling_count5 | -0.1895 | 0.04401 | -4.305 | -0.2757 | -0.1032 | fixed |
| sibling_count5+ | -0.4382 | 0.04436 | -9.88 | -0.5252 | -0.3513 | fixed |
| sd_(Intercept).mother_pidlink | 0.5182 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.5672 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.674 | 0.3137 | -21.28 | -7.289 | -6.06 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7136 | 0.03554 | 20.08 | 0.6439 | 0.7832 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02225 | 0.001269 | -17.53 | -0.02473 | -0.01976 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0002238 | 0.00001439 | 15.55 | 0.0001955 | 0.000252 | fixed |
| male | -0.08054 | 0.01796 | -4.484 | -0.1157 | -0.04534 | fixed |
| sibling_count3 | 0.00008121 | 0.03249 | 0.002499 | -0.06361 | 0.06377 | fixed |
| sibling_count4 | -0.09508 | 0.03694 | -2.574 | -0.1675 | -0.02268 | fixed |
| sibling_count5 | -0.2215 | 0.04531 | -4.888 | -0.3103 | -0.1327 | fixed |
| sibling_count5+ | -0.4607 | 0.04527 | -10.18 | -0.5494 | -0.372 | fixed |
| birth_order_nonlinear2 | -0.05633 | 0.02197 | -2.563 | -0.0994 | -0.01326 | fixed |
| birth_order_nonlinear3 | 0.01674 | 0.0274 | 0.611 | -0.03696 | 0.07044 | fixed |
| birth_order_nonlinear4 | 0.08775 | 0.03516 | 2.496 | 0.01884 | 0.1567 | fixed |
| birth_order_nonlinear5 | 0.1372 | 0.04421 | 3.105 | 0.0506 | 0.2239 | fixed |
| birth_order_nonlinear5+ | 0.07675 | 0.04577 | 1.677 | -0.01296 | 0.1665 | fixed |
| sd_(Intercept).mother_pidlink | 0.5176 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.5664 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -6.684 | 0.3148 | -21.24 | -7.301 | -6.067 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.7138 | 0.03565 | 20.02 | 0.6439 | 0.7837 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.02226 | 0.001273 | -17.48 | -0.02476 | -0.01977 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000224 | 0.00001445 | 15.5 | 0.0001957 | 0.0002523 | fixed |
| male | -0.07992 | 0.01799 | -4.444 | -0.1152 | -0.04467 | fixed |
| count_birth_order2/2 | -0.02734 | 0.03915 | -0.6983 | -0.1041 | 0.0494 | fixed |
| count_birth_order1/3 | 0.03303 | 0.03893 | 0.8485 | -0.04327 | 0.1093 | fixed |
| count_birth_order2/3 | -0.06894 | 0.04228 | -1.63 | -0.1518 | 0.01393 | fixed |
| count_birth_order3/3 | 0.008928 | 0.04599 | 0.1941 | -0.08122 | 0.09907 | fixed |
| count_birth_order1/4 | -0.09519 | 0.04764 | -1.998 | -0.1886 | -0.00181 | fixed |
| count_birth_order2/4 | -0.1545 | 0.04852 | -3.184 | -0.2496 | -0.05937 | fixed |
| count_birth_order3/4 | -0.0412 | 0.05053 | -0.8153 | -0.1402 | 0.05784 | fixed |
| count_birth_order4/4 | 0.003472 | 0.05308 | 0.06542 | -0.1006 | 0.1075 | fixed |
| count_birth_order1/5 | -0.2173 | 0.06431 | -3.379 | -0.3434 | -0.09126 | fixed |
| count_birth_order2/5 | -0.2431 | 0.06969 | -3.489 | -0.3797 | -0.1065 | fixed |
| count_birth_order3/5 | -0.1786 | 0.06617 | -2.699 | -0.3082 | -0.04887 | fixed |
| count_birth_order4/5 | -0.1625 | 0.06474 | -2.509 | -0.2893 | -0.03557 | fixed |
| count_birth_order5/5 | -0.06279 | 0.06813 | -0.9216 | -0.1963 | 0.07075 | fixed |
| count_birth_order1/5+ | -0.4742 | 0.06382 | -7.43 | -0.5993 | -0.3491 | fixed |
| count_birth_order2/5+ | -0.4845 | 0.06341 | -7.64 | -0.6087 | -0.3602 | fixed |
| count_birth_order3/5+ | -0.4592 | 0.06144 | -7.474 | -0.5796 | -0.3388 | fixed |
| count_birth_order4/5+ | -0.3303 | 0.06021 | -5.486 | -0.4483 | -0.2123 | fixed |
| count_birth_order5/5+ | -0.3212 | 0.05599 | -5.737 | -0.431 | -0.2115 | fixed |
| count_birth_order5+/5+ | -0.3735 | 0.04488 | -8.322 | -0.4615 | -0.2855 | fixed |
| sd_(Intercept).mother_pidlink | 0.5172 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.5669 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 13356 | 13430 | -6667 | 13334 | NA | NA | NA |
| 12 | 13352 | 13432 | -6664 | 13328 | 6.342 | 1 | 0.01179 |
| 16 | 13338 | 13446 | -6653 | 13306 | 21.48 | 4 | 0.0002543 |
| 26 | 13353 | 13528 | -6651 | 13301 | 4.93 | 10 | 0.8958 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = Elementary_missed)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.0359 | 0.07117 | -0.5044 | -0.1754 | 0.1036 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.005098 | 0.008201 | 0.6217 | -0.01098 | 0.02117 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001344 | 0.0002977 | -0.4516 | -0.0007179 | 0.000449 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000001175 | 0.00000341 | 0.3446 | -0.000005508 | 0.000007858 | fixed |
| male | 0.01183 | 0.004139 | 2.857 | 0.003713 | 0.01994 | fixed |
| sibling_count3 | -0.004516 | 0.007623 | -0.5924 | -0.01946 | 0.01042 | fixed |
| sibling_count4 | 0.002375 | 0.007854 | 0.3024 | -0.01302 | 0.01777 | fixed |
| sibling_count5 | 0.0005693 | 0.008131 | 0.07002 | -0.01537 | 0.0165 | fixed |
| sibling_count5+ | 0.01343 | 0.006512 | 2.062 | 0.0006617 | 0.02619 | fixed |
| sd_(Intercept).mother_pidlink | 0.03164 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1769 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.03567 | 0.07116 | -0.5013 | -0.1751 | 0.1038 | fixed |
| birth_order | 0.001618 | 0.000855 | 1.893 | -0.00005746 | 0.003294 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.004764 | 0.008202 | 0.5809 | -0.01131 | 0.02084 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001223 | 0.0002977 | -0.4107 | -0.0007058 | 0.0004612 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000001066 | 0.00000341 | 0.3126 | -0.000005617 | 0.000007748 | fixed |
| male | 0.01187 | 0.004138 | 2.869 | 0.003762 | 0.01998 | fixed |
| sibling_count3 | -0.005119 | 0.007628 | -0.6711 | -0.02007 | 0.009832 | fixed |
| sibling_count4 | 0.0008348 | 0.007895 | 0.1057 | -0.01464 | 0.01631 | fixed |
| sibling_count5 | -0.001974 | 0.008239 | -0.2396 | -0.01812 | 0.01417 | fixed |
| sibling_count5+ | 0.005909 | 0.007626 | 0.7748 | -0.009038 | 0.02086 | fixed |
| sd_(Intercept).mother_pidlink | 0.03155 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1769 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.03677 | 0.07132 | -0.5155 | -0.1766 | 0.103 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.005009 | 0.008207 | 0.6103 | -0.01108 | 0.0211 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001286 | 0.000298 | -0.4316 | -0.0007126 | 0.0004554 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000011 | 0.000003412 | 0.3224 | -0.000005588 | 0.000007788 | fixed |
| male | 0.01198 | 0.00414 | 2.893 | 0.003862 | 0.02009 | fixed |
| sibling_count3 | -0.004969 | 0.007769 | -0.6396 | -0.0202 | 0.01026 | fixed |
| sibling_count4 | 0.004068 | 0.008262 | 0.4924 | -0.01213 | 0.02026 | fixed |
| sibling_count5 | 0.001791 | 0.008784 | 0.2039 | -0.01543 | 0.01901 | fixed |
| sibling_count5+ | 0.009914 | 0.008273 | 1.198 | -0.006302 | 0.02613 | fixed |
| birth_order_nonlinear2 | 0.002091 | 0.006096 | 0.3431 | -0.009856 | 0.01404 | fixed |
| birth_order_nonlinear3 | 0.002502 | 0.007308 | 0.3424 | -0.01182 | 0.01683 | fixed |
| birth_order_nonlinear4 | -0.01034 | 0.008412 | -1.229 | -0.02682 | 0.006152 | fixed |
| birth_order_nonlinear5 | 0.001859 | 0.009411 | 0.1975 | -0.01659 | 0.0203 | fixed |
| birth_order_nonlinear5+ | 0.009152 | 0.007986 | 1.146 | -0.006501 | 0.02481 | fixed |
| sd_(Intercept).mother_pidlink | 0.03137 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1769 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.04214 | 0.07141 | -0.5902 | -0.1821 | 0.09781 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.005408 | 0.008208 | 0.6588 | -0.01068 | 0.02149 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001434 | 0.000298 | -0.4811 | -0.0007274 | 0.0004407 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000001267 | 0.000003413 | 0.3713 | -0.000005422 | 0.000007956 | fixed |
| male | 0.01215 | 0.00414 | 2.935 | 0.004036 | 0.02027 | fixed |
| count_birth_order2/2 | 0.007844 | 0.0116 | 0.6762 | -0.01489 | 0.03058 | fixed |
| count_birth_order1/3 | 0.001005 | 0.01024 | 0.09822 | -0.01906 | 0.02107 | fixed |
| count_birth_order2/3 | -0.003272 | 0.01139 | -0.2873 | -0.02559 | 0.01905 | fixed |
| count_birth_order3/3 | -0.005575 | 0.01312 | -0.425 | -0.03129 | 0.02014 | fixed |
| count_birth_order1/4 | 0.006385 | 0.01209 | 0.5281 | -0.01731 | 0.03008 | fixed |
| count_birth_order2/4 | 0.01971 | 0.01252 | 1.574 | -0.004833 | 0.04425 | fixed |
| count_birth_order3/4 | -0.01251 | 0.01353 | -0.9247 | -0.03903 | 0.01401 | fixed |
| count_birth_order4/4 | 0.002527 | 0.01402 | 0.1803 | -0.02495 | 0.03 | fixed |
| count_birth_order1/5 | -0.008057 | 0.01393 | -0.5784 | -0.03536 | 0.01925 | fixed |
| count_birth_order2/5 | 0.008299 | 0.01493 | 0.5557 | -0.02097 | 0.03757 | fixed |
| count_birth_order3/5 | 0.01165 | 0.01465 | 0.795 | -0.01707 | 0.04037 | fixed |
| count_birth_order4/5 | 0.004803 | 0.01549 | 0.3101 | -0.02556 | 0.03517 | fixed |
| count_birth_order5/5 | 0.001672 | 0.01482 | 0.1128 | -0.02737 | 0.03071 | fixed |
| count_birth_order1/5+ | 0.01773 | 0.01285 | 1.38 | -0.007455 | 0.04291 | fixed |
| count_birth_order2/5+ | -0.001829 | 0.01301 | -0.1406 | -0.02733 | 0.02367 | fixed |
| count_birth_order3/5+ | 0.03193 | 0.01249 | 2.557 | 0.007453 | 0.05641 | fixed |
| count_birth_order4/5+ | -0.007931 | 0.01181 | -0.6717 | -0.03107 | 0.01521 | fixed |
| count_birth_order5/5+ | 0.0157 | 0.01134 | 1.385 | -0.006525 | 0.03793 | fixed |
| count_birth_order5+/5+ | 0.02106 | 0.008272 | 2.546 | 0.004846 | 0.03727 | fixed |
| sd_(Intercept).mother_pidlink | 0.0319 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1768 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -4483 | -4407 | 2252 | -4505 | NA | NA | NA |
| 12 | -4485 | -4401 | 2254 | -4509 | 3.587 | 1 | 0.05823 |
| 16 | -4478 | -4367 | 2255 | -4510 | 1.743 | 4 | 0.7829 |
| 26 | -4472 | -4292 | 2262 | -4524 | 13.98 | 10 | 0.1738 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.1442 | 0.1069 | -1.349 | -0.3538 | 0.06538 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01976 | 0.01294 | 1.527 | -0.005603 | 0.04512 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0007469 | 0.0004952 | -1.508 | -0.001718 | 0.0002237 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000009176 | 0.000005979 | 1.535 | -0.000002543 | 0.0000209 | fixed |
| male | 0.006646 | 0.005295 | 1.255 | -0.003731 | 0.01702 | fixed |
| sibling_count3 | -0.003274 | 0.007264 | -0.4507 | -0.01751 | 0.01096 | fixed |
| sibling_count4 | -0.004942 | 0.008107 | -0.6095 | -0.02083 | 0.01095 | fixed |
| sibling_count5 | 0.002172 | 0.009593 | 0.2265 | -0.01663 | 0.02097 | fixed |
| sibling_count5+ | 0.02326 | 0.00863 | 2.696 | 0.006348 | 0.04018 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1667 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.145 | 0.107 | -1.355 | -0.3548 | 0.0647 | fixed |
| birth_order | 0.0004245 | 0.001896 | 0.2238 | -0.003293 | 0.004142 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0198 | 0.01294 | 1.53 | -0.005568 | 0.04516 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0007491 | 0.0004954 | -1.512 | -0.00172 | 0.0002219 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000009215 | 0.000005983 | 1.54 | -0.00000251 | 0.00002094 | fixed |
| male | 0.006655 | 0.005296 | 1.257 | -0.003724 | 0.01703 | fixed |
| sibling_count3 | -0.003473 | 0.007319 | -0.4746 | -0.01782 | 0.01087 | fixed |
| sibling_count4 | -0.005406 | 0.008369 | -0.6459 | -0.02181 | 0.011 | fixed |
| sibling_count5 | 0.001394 | 0.0102 | 0.1366 | -0.01861 | 0.02139 | fixed |
| sibling_count5+ | 0.02152 | 0.01163 | 1.85 | -0.00128 | 0.04431 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1667 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.1453 | 0.1071 | -1.356 | -0.3552 | 0.06464 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0198 | 0.01295 | 1.529 | -0.005579 | 0.04518 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0007478 | 0.0004957 | -1.509 | -0.001719 | 0.0002237 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000009187 | 0.000005986 | 1.535 | -0.000002546 | 0.00002092 | fixed |
| male | 0.006736 | 0.005298 | 1.271 | -0.003648 | 0.01712 | fixed |
| sibling_count3 | -0.003312 | 0.007538 | -0.4394 | -0.01809 | 0.01146 | fixed |
| sibling_count4 | -0.000942 | 0.008859 | -0.1063 | -0.01831 | 0.01642 | fixed |
| sibling_count5 | 0.007974 | 0.01095 | 0.7286 | -0.01348 | 0.02943 | fixed |
| sibling_count5+ | 0.02341 | 0.01232 | 1.9 | -0.0007407 | 0.04756 | fixed |
| birth_order_nonlinear2 | 0.001382 | 0.006812 | 0.2029 | -0.01197 | 0.01473 | fixed |
| birth_order_nonlinear3 | 0.0001446 | 0.008687 | 0.01664 | -0.01688 | 0.01717 | fixed |
| birth_order_nonlinear4 | -0.01699 | 0.01116 | -1.523 | -0.03886 | 0.004881 | fixed |
| birth_order_nonlinear5 | -0.007998 | 0.01468 | -0.5448 | -0.03677 | 0.02078 | fixed |
| birth_order_nonlinear5+ | 0.007723 | 0.01497 | 0.5159 | -0.02162 | 0.03707 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1667 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.143 | 0.1073 | -1.332 | -0.3533 | 0.06734 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0197 | 0.01297 | 1.519 | -0.005722 | 0.04513 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0007376 | 0.0004966 | -1.485 | -0.001711 | 0.0002357 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000008982 | 0.000005999 | 1.497 | -0.000002776 | 0.00002074 | fixed |
| male | 0.006549 | 0.005306 | 1.234 | -0.00385 | 0.01695 | fixed |
| count_birth_order2/2 | -0.006425 | 0.01127 | -0.5701 | -0.02852 | 0.01566 | fixed |
| count_birth_order1/3 | -0.01274 | 0.009904 | -1.286 | -0.03215 | 0.006674 | fixed |
| count_birth_order2/3 | 0.001926 | 0.01084 | 0.1776 | -0.01933 | 0.02318 | fixed |
| count_birth_order3/3 | -0.001935 | 0.01213 | -0.1595 | -0.02572 | 0.02185 | fixed |
| count_birth_order1/4 | -0.000406 | 0.01319 | -0.03077 | -0.02627 | 0.02545 | fixed |
| count_birth_order2/4 | 0.002909 | 0.01367 | 0.2127 | -0.02389 | 0.02971 | fixed |
| count_birth_order3/4 | -0.01698 | 0.0144 | -1.179 | -0.04521 | 0.01125 | fixed |
| count_birth_order4/4 | -0.01695 | 0.01423 | -1.19 | -0.04485 | 0.01095 | fixed |
| count_birth_order1/5 | 0.005682 | 0.01916 | 0.2965 | -0.03187 | 0.04324 | fixed |
| count_birth_order2/5 | -0.001842 | 0.02077 | -0.08868 | -0.04255 | 0.03887 | fixed |
| count_birth_order3/5 | 0.004445 | 0.01888 | 0.2354 | -0.03257 | 0.04146 | fixed |
| count_birth_order4/5 | -0.0002872 | 0.01775 | -0.01618 | -0.03508 | 0.0345 | fixed |
| count_birth_order5/5 | -0.007808 | 0.01825 | -0.4279 | -0.04357 | 0.02795 | fixed |
| count_birth_order1/5+ | 0.04048 | 0.02442 | 1.658 | -0.007385 | 0.08835 | fixed |
| count_birth_order2/5+ | 0.003233 | 0.02367 | 0.1366 | -0.04315 | 0.04962 | fixed |
| count_birth_order3/5+ | 0.04167 | 0.02177 | 1.914 | -0.0009953 | 0.08434 | fixed |
| count_birth_order4/5+ | -0.01883 | 0.0199 | -0.9464 | -0.05783 | 0.02017 | fixed |
| count_birth_order5/5+ | 0.01747 | 0.01754 | 0.9955 | -0.01692 | 0.05185 | fixed |
| count_birth_order5+/5+ | 0.02843 | 0.01179 | 2.412 | 0.005327 | 0.05154 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1668 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -2946 | -2877 | 1484 | -2968 | NA | NA | NA |
| 12 | -2944 | -2869 | 1484 | -2968 | 0.05022 | 1 | 0.8227 |
| 16 | -2940 | -2840 | 1486 | -2972 | 4.006 | 4 | 0.4052 |
| 26 | -2929 | -2765 | 1490 | -2981 | 8.27 | 10 | 0.6024 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.1486 | 0.1065 | -1.395 | -0.3573 | 0.06015 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02007 | 0.01288 | 1.558 | -0.00518 | 0.04533 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0007564 | 0.0004933 | -1.533 | -0.001723 | 0.0002105 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000009311 | 0.000005958 | 1.563 | -0.000002366 | 0.00002099 | fixed |
| male | 0.006283 | 0.005263 | 1.194 | -0.004032 | 0.0166 | fixed |
| sibling_count3 | 0.00281 | 0.007829 | 0.3589 | -0.01253 | 0.01815 | fixed |
| sibling_count4 | -0.005559 | 0.008443 | -0.6585 | -0.02211 | 0.01099 | fixed |
| sibling_count5 | -0.005294 | 0.009292 | -0.5697 | -0.02351 | 0.01292 | fixed |
| sibling_count5+ | 0.01816 | 0.008216 | 2.21 | 0.002056 | 0.03426 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1666 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.1523 | 0.1065 | -1.429 | -0.3611 | 0.05653 | fixed |
| birth_order | 0.001729 | 0.001583 | 1.092 | -0.001374 | 0.004832 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02027 | 0.01289 | 1.573 | -0.004982 | 0.04553 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0007663 | 0.0004934 | -1.553 | -0.001733 | 0.0002007 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000009479 | 0.00000596 | 1.59 | -0.000002202 | 0.00002116 | fixed |
| male | 0.006291 | 0.005263 | 1.195 | -0.004024 | 0.01661 | fixed |
| sibling_count3 | 0.00197 | 0.007866 | 0.2504 | -0.01345 | 0.01739 | fixed |
| sibling_count4 | -0.007413 | 0.008611 | -0.8609 | -0.02429 | 0.009465 | fixed |
| sibling_count5 | -0.008217 | 0.00967 | -0.8498 | -0.02717 | 0.01074 | fixed |
| sibling_count5+ | 0.01149 | 0.01024 | 1.122 | -0.008579 | 0.03155 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1666 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.1515 | 0.1067 | -1.42 | -0.3606 | 0.05755 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02036 | 0.0129 | 1.579 | -0.004919 | 0.04564 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0007676 | 0.0004938 | -1.554 | -0.001735 | 0.0002004 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000009457 | 0.000005966 | 1.585 | -0.000002236 | 0.00002115 | fixed |
| male | 0.006342 | 0.005267 | 1.204 | -0.003982 | 0.01667 | fixed |
| sibling_count3 | 0.002582 | 0.008089 | 0.3193 | -0.01327 | 0.01844 | fixed |
| sibling_count4 | -0.004501 | 0.009063 | -0.4966 | -0.02226 | 0.01326 | fixed |
| sibling_count5 | -0.003395 | 0.01036 | -0.3278 | -0.0237 | 0.01691 | fixed |
| sibling_count5+ | 0.01573 | 0.01075 | 1.464 | -0.005334 | 0.0368 | fixed |
| birth_order_nonlinear2 | 0.001636 | 0.006938 | 0.2358 | -0.01196 | 0.01523 | fixed |
| birth_order_nonlinear3 | 0.0009229 | 0.008591 | 0.1074 | -0.01592 | 0.01776 | fixed |
| birth_order_nonlinear4 | -0.005306 | 0.01049 | -0.506 | -0.02586 | 0.01525 | fixed |
| birth_order_nonlinear5 | -0.003994 | 0.0136 | -0.2938 | -0.03064 | 0.02265 | fixed |
| birth_order_nonlinear5+ | 0.009254 | 0.0127 | 0.7289 | -0.01563 | 0.03414 | fixed |
| sd_(Intercept).mother_pidlink | 0.00000008748 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1666 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.1472 | 0.1069 | -1.377 | -0.3566 | 0.06224 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02004 | 0.01292 | 1.552 | -0.005274 | 0.04535 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.000755 | 0.0004946 | -1.527 | -0.001724 | 0.0002143 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000009301 | 0.000005975 | 1.557 | -0.000002408 | 0.00002101 | fixed |
| male | 0.006449 | 0.005273 | 1.223 | -0.003887 | 0.01678 | fixed |
| count_birth_order2/2 | -0.003815 | 0.01228 | -0.3108 | -0.02788 | 0.02025 | fixed |
| count_birth_order1/3 | -0.003669 | 0.01069 | -0.3433 | -0.02461 | 0.01728 | fixed |
| count_birth_order2/3 | 0.007273 | 0.0116 | 0.6268 | -0.01547 | 0.03001 | fixed |
| count_birth_order3/3 | 0.003067 | 0.01296 | 0.2366 | -0.02234 | 0.02847 | fixed |
| count_birth_order1/4 | 0.0007049 | 0.01346 | 0.05236 | -0.02568 | 0.02709 | fixed |
| count_birth_order2/4 | 0.001997 | 0.01358 | 0.147 | -0.02462 | 0.02861 | fixed |
| count_birth_order3/4 | -0.02048 | 0.01513 | -1.354 | -0.05014 | 0.009174 | fixed |
| count_birth_order4/4 | -0.01489 | 0.01471 | -1.012 | -0.04372 | 0.01394 | fixed |
| count_birth_order1/5 | -0.01108 | 0.01672 | -0.6626 | -0.04386 | 0.0217 | fixed |
| count_birth_order2/5 | -0.005183 | 0.01899 | -0.2729 | -0.0424 | 0.03204 | fixed |
| count_birth_order3/5 | -0.008834 | 0.01738 | -0.5082 | -0.0429 | 0.02523 | fixed |
| count_birth_order4/5 | -0.008066 | 0.0178 | -0.4531 | -0.04296 | 0.02683 | fixed |
| count_birth_order5/5 | 0.0008635 | 0.01743 | 0.04954 | -0.0333 | 0.03502 | fixed |
| count_birth_order1/5+ | 0.0153 | 0.01781 | 0.8591 | -0.0196 | 0.05021 | fixed |
| count_birth_order2/5+ | -0.006775 | 0.01984 | -0.3415 | -0.04566 | 0.03211 | fixed |
| count_birth_order3/5+ | 0.04067 | 0.01842 | 2.208 | 0.004567 | 0.07677 | fixed |
| count_birth_order4/5+ | 0.01091 | 0.01658 | 0.6578 | -0.02159 | 0.0434 | fixed |
| count_birth_order5/5+ | -0.0003145 | 0.01759 | -0.01788 | -0.03479 | 0.03417 | fixed |
| count_birth_order5+/5+ | 0.02317 | 0.01124 | 2.062 | 0.001146 | 0.0452 | fixed |
| sd_(Intercept).mother_pidlink | 0.00000002179 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1667 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -2986 | -2917 | 1504 | -3008 | NA | NA | NA |
| 12 | -2985 | -2910 | 1505 | -3009 | 1.196 | 1 | 0.2742 |
| 16 | -2977 | -2877 | 1505 | -3009 | 0.2612 | 4 | 0.9922 |
| 26 | -2965 | -2802 | 1509 | -3017 | 7.849 | 10 | 0.6436 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.1524 | 0.1069 | -1.425 | -0.362 | 0.05723 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02052 | 0.01293 | 1.587 | -0.004829 | 0.04587 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0007638 | 0.0004946 | -1.544 | -0.001733 | 0.0002056 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000093 | 0.000005968 | 1.558 | -0.000002398 | 0.000021 | fixed |
| male | 0.004826 | 0.005319 | 0.9073 | -0.005599 | 0.01525 | fixed |
| sibling_count3 | -0.001595 | 0.00716 | -0.2227 | -0.01563 | 0.01244 | fixed |
| sibling_count4 | -0.007724 | 0.008028 | -0.9621 | -0.02346 | 0.008011 | fixed |
| sibling_count5 | 0.002436 | 0.009835 | 0.2477 | -0.01684 | 0.02171 | fixed |
| sibling_count5+ | 0.02079 | 0.008775 | 2.37 | 0.003594 | 0.03799 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1656 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.1561 | 0.107 | -1.459 | -0.3658 | 0.05362 | fixed |
| birth_order | 0.002012 | 0.001944 | 1.035 | -0.001798 | 0.005823 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02069 | 0.01293 | 1.599 | -0.004663 | 0.04604 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0007734 | 0.0004947 | -1.563 | -0.001743 | 0.0001961 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00000948 | 0.000005971 | 1.588 | -0.000002222 | 0.00002118 | fixed |
| male | 0.004883 | 0.005319 | 0.9181 | -0.005542 | 0.01531 | fixed |
| sibling_count3 | -0.002519 | 0.007215 | -0.3492 | -0.01666 | 0.01162 | fixed |
| sibling_count4 | -0.00991 | 0.008301 | -1.194 | -0.02618 | 0.006361 | fixed |
| sibling_count5 | -0.001106 | 0.01041 | -0.1062 | -0.02152 | 0.0193 | fixed |
| sibling_count5+ | 0.01253 | 0.01187 | 1.056 | -0.01073 | 0.03578 | fixed |
| sd_(Intercept).mother_pidlink | 0.00000009768 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1656 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.1555 | 0.1071 | -1.451 | -0.3654 | 0.0545 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02077 | 0.01294 | 1.605 | -0.004599 | 0.04613 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0007756 | 0.000495 | -1.567 | -0.001746 | 0.0001947 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000009493 | 0.000005975 | 1.589 | -0.000002219 | 0.0000212 | fixed |
| male | 0.004933 | 0.005323 | 0.9269 | -0.005499 | 0.01537 | fixed |
| sibling_count3 | -0.002476 | 0.007436 | -0.333 | -0.01705 | 0.0121 | fixed |
| sibling_count4 | -0.006352 | 0.008807 | -0.7213 | -0.02361 | 0.01091 | fixed |
| sibling_count5 | 0.005045 | 0.01113 | 0.4534 | -0.01677 | 0.02686 | fixed |
| sibling_count5+ | 0.0149 | 0.01266 | 1.177 | -0.009919 | 0.03972 | fixed |
| birth_order_nonlinear2 | 0.003457 | 0.006762 | 0.5112 | -0.009797 | 0.01671 | fixed |
| birth_order_nonlinear3 | 0.004017 | 0.008668 | 0.4635 | -0.01297 | 0.02101 | fixed |
| birth_order_nonlinear4 | -0.009119 | 0.01146 | -0.7957 | -0.03158 | 0.01334 | fixed |
| birth_order_nonlinear5 | -0.003768 | 0.0153 | -0.2462 | -0.03376 | 0.02623 | fixed |
| birth_order_nonlinear5+ | 0.01701 | 0.01547 | 1.1 | -0.01331 | 0.04734 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1656 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.1605 | 0.1074 | -1.495 | -0.371 | 0.04999 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02159 | 0.01297 | 1.664 | -0.003843 | 0.04702 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0008016 | 0.0004963 | -1.615 | -0.001774 | 0.0001712 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000009745 | 0.000005992 | 1.626 | -0.000001999 | 0.00002149 | fixed |
| male | 0.005014 | 0.005333 | 0.9402 | -0.005438 | 0.01547 | fixed |
| count_birth_order2/2 | -0.004404 | 0.0109 | -0.404 | -0.02577 | 0.01696 | fixed |
| count_birth_order1/3 | -0.01262 | 0.009776 | -1.291 | -0.03178 | 0.00654 | fixed |
| count_birth_order2/3 | 0.003637 | 0.01089 | 0.334 | -0.01771 | 0.02498 | fixed |
| count_birth_order3/3 | 0.005645 | 0.01197 | 0.4714 | -0.01782 | 0.02911 | fixed |
| count_birth_order1/4 | -0.004056 | 0.01325 | -0.3062 | -0.03002 | 0.02191 | fixed |
| count_birth_order2/4 | -0.001733 | 0.01367 | -0.1268 | -0.02852 | 0.02505 | fixed |
| count_birth_order3/4 | -0.01717 | 0.01406 | -1.222 | -0.04472 | 0.01038 | fixed |
| count_birth_order4/4 | -0.01619 | 0.01435 | -1.128 | -0.04431 | 0.01194 | fixed |
| count_birth_order1/5 | 0.006246 | 0.01912 | 0.3266 | -0.03123 | 0.04372 | fixed |
| count_birth_order2/5 | 0.0009551 | 0.02176 | 0.04389 | -0.0417 | 0.04361 | fixed |
| count_birth_order3/5 | 0.009442 | 0.01987 | 0.4752 | -0.0295 | 0.04839 | fixed |
| count_birth_order4/5 | 0.003884 | 0.01857 | 0.2091 | -0.03252 | 0.04029 | fixed |
| count_birth_order5/5 | -0.01661 | 0.0193 | -0.8607 | -0.05445 | 0.02122 | fixed |
| count_birth_order1/5+ | 0.02319 | 0.02464 | 0.9411 | -0.02511 | 0.07149 | fixed |
| count_birth_order2/5+ | 0.005438 | 0.02432 | 0.2236 | -0.04223 | 0.0531 | fixed |
| count_birth_order3/5+ | 0.01683 | 0.02315 | 0.7271 | -0.02854 | 0.0622 | fixed |
| count_birth_order4/5+ | -0.01712 | 0.02153 | -0.7949 | -0.05932 | 0.02509 | fixed |
| count_birth_order5/5+ | 0.02131 | 0.01811 | 1.177 | -0.01418 | 0.0568 | fixed |
| count_birth_order5+/5+ | 0.02908 | 0.01199 | 2.425 | 0.005578 | 0.05258 | fixed |
| sd_(Intercept).mother_pidlink | 0.000000008555 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1657 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -2935 | -2866 | 1478 | -2957 | NA | NA | NA |
| 12 | -2934 | -2859 | 1479 | -2958 | 1.074 | 1 | 0.3001 |
| 16 | -2928 | -2828 | 1480 | -2960 | 2.375 | 4 | 0.6672 |
| 26 | -2915 | -2752 | 1483 | -2967 | 6.831 | 10 | 0.7413 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = Elementary_worked)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.07964 | 0.08885 | -0.8964 | -0.2538 | 0.0945 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.00962 | 0.01022 | 0.9411 | -0.01041 | 0.02966 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0003134 | 0.0003703 | -0.8464 | -0.001039 | 0.0004123 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000004026 | 0.00000423 | 0.9519 | -0.000004264 | 0.00001232 | fixed |
| male | 0.03192 | 0.005231 | 6.103 | 0.02167 | 0.04218 | fixed |
| sibling_count3 | -0.008452 | 0.009849 | -0.8582 | -0.02776 | 0.01085 | fixed |
| sibling_count4 | 0.00381 | 0.01018 | 0.3744 | -0.01613 | 0.02375 | fixed |
| sibling_count5 | 0.01119 | 0.01059 | 1.057 | -0.009562 | 0.03194 | fixed |
| sibling_count5+ | 0.03482 | 0.008449 | 4.122 | 0.01826 | 0.05138 | fixed |
| sd_(Intercept).mother_pidlink | 0.08269 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2132 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.07986 | 0.08885 | -0.8988 | -0.254 | 0.09429 | fixed |
| birth_order | 0.0009563 | 0.001108 | 0.8631 | -0.001215 | 0.003128 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.009444 | 0.01022 | 0.9236 | -0.0106 | 0.02948 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0003064 | 0.0003704 | -0.8273 | -0.001032 | 0.0004195 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000003962 | 0.00000423 | 0.9364 | -0.00000433 | 0.00001225 | fixed |
| male | 0.03195 | 0.005231 | 6.108 | 0.0217 | 0.04221 | fixed |
| sibling_count3 | -0.008806 | 0.009856 | -0.8934 | -0.02812 | 0.01051 | fixed |
| sibling_count4 | 0.002898 | 0.01023 | 0.2833 | -0.01715 | 0.02295 | fixed |
| sibling_count5 | 0.009665 | 0.01073 | 0.9007 | -0.01137 | 0.0307 | fixed |
| sibling_count5+ | 0.03038 | 0.009896 | 3.069 | 0.01098 | 0.04977 | fixed |
| sd_(Intercept).mother_pidlink | 0.08257 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2133 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.0841 | 0.08913 | -0.9436 | -0.2588 | 0.09058 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.009802 | 0.01024 | 0.9574 | -0.01026 | 0.02987 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0003176 | 0.0003709 | -0.8565 | -0.001044 | 0.0004092 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000004062 | 0.000004236 | 0.9589 | -0.00000424 | 0.00001236 | fixed |
| male | 0.03209 | 0.005232 | 6.133 | 0.02184 | 0.04234 | fixed |
| sibling_count3 | -0.008324 | 0.01002 | -0.8303 | -0.02797 | 0.01132 | fixed |
| sibling_count4 | 0.006027 | 0.01067 | 0.5647 | -0.01489 | 0.02695 | fixed |
| sibling_count5 | 0.01112 | 0.01139 | 0.9759 | -0.01121 | 0.03344 | fixed |
| sibling_count5+ | 0.0318 | 0.01067 | 2.979 | 0.01088 | 0.05271 | fixed |
| birth_order_nonlinear2 | 0.006231 | 0.007625 | 0.8172 | -0.008714 | 0.02118 | fixed |
| birth_order_nonlinear3 | 0.0001958 | 0.009161 | 0.02138 | -0.01776 | 0.01815 | fixed |
| birth_order_nonlinear4 | -0.008989 | 0.01056 | -0.8511 | -0.02969 | 0.01171 | fixed |
| birth_order_nonlinear5 | 0.01249 | 0.01183 | 1.056 | -0.01069 | 0.03567 | fixed |
| birth_order_nonlinear5+ | 0.007857 | 0.01017 | 0.7724 | -0.01208 | 0.02779 | fixed |
| sd_(Intercept).mother_pidlink | 0.08259 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2133 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.08246 | 0.08926 | -0.9238 | -0.2574 | 0.09248 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.009748 | 0.01024 | 0.952 | -0.01032 | 0.02982 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0003177 | 0.000371 | -0.8564 | -0.001045 | 0.0004094 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000004095 | 0.000004238 | 0.9664 | -0.00000421 | 0.0000124 | fixed |
| male | 0.03227 | 0.005234 | 6.167 | 0.02202 | 0.04253 | fixed |
| count_birth_order2/2 | 0.00326 | 0.01454 | 0.2242 | -0.02524 | 0.03176 | fixed |
| count_birth_order1/3 | -0.004176 | 0.013 | -0.3212 | -0.02966 | 0.0213 | fixed |
| count_birth_order2/3 | 0.0007817 | 0.01446 | 0.05408 | -0.02755 | 0.02912 | fixed |
| count_birth_order3/3 | -0.02654 | 0.01664 | -1.595 | -0.05916 | 0.006077 | fixed |
| count_birth_order1/4 | 0.001379 | 0.01533 | 0.08991 | -0.02868 | 0.03143 | fixed |
| count_birth_order2/4 | 0.01607 | 0.01589 | 1.011 | -0.01507 | 0.04722 | fixed |
| count_birth_order3/4 | 0.001507 | 0.01716 | 0.08783 | -0.03213 | 0.03514 | fixed |
| count_birth_order4/4 | -0.00101 | 0.01778 | -0.05678 | -0.03586 | 0.03384 | fixed |
| count_birth_order1/5 | 0.02121 | 0.01767 | 1.2 | -0.01343 | 0.05585 | fixed |
| count_birth_order2/5 | 0.008517 | 0.01889 | 0.451 | -0.0285 | 0.04553 | fixed |
| count_birth_order3/5 | -0.004503 | 0.01857 | -0.2426 | -0.04089 | 0.03189 | fixed |
| count_birth_order4/5 | 0.01404 | 0.01963 | 0.7155 | -0.02443 | 0.05252 | fixed |
| count_birth_order5/5 | 0.02075 | 0.01878 | 1.105 | -0.01607 | 0.05756 | fixed |
| count_birth_order1/5+ | 0.01348 | 0.01626 | 0.829 | -0.01839 | 0.04536 | fixed |
| count_birth_order2/5+ | 0.03364 | 0.01647 | 2.043 | 0.001366 | 0.06592 | fixed |
| count_birth_order3/5+ | 0.05796 | 0.0158 | 3.669 | 0.027 | 0.08893 | fixed |
| count_birth_order4/5+ | 0.01383 | 0.01495 | 0.9249 | -0.01548 | 0.04314 | fixed |
| count_birth_order5/5+ | 0.04418 | 0.01434 | 3.08 | 0.01606 | 0.07229 | fixed |
| count_birth_order5+/5+ | 0.03869 | 0.01059 | 3.654 | 0.01793 | 0.05944 | fixed |
| sd_(Intercept).mother_pidlink | 0.08253 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2133 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -891.6 | -815.4 | 456.8 | -913.6 | NA | NA | NA |
| 12 | -890.4 | -807.2 | 457.2 | -914.4 | 0.7467 | 1 | 0.3875 |
| 16 | -885.9 | -775 | 458.9 | -917.9 | 3.481 | 4 | 0.4807 |
| 26 | -877 | -696.8 | 464.5 | -929 | 11.14 | 10 | 0.3467 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.01121 | 0.12 | 0.09338 | -0.224 | 0.2464 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.0008552 | 0.01454 | -0.05884 | -0.02934 | 0.02763 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0000577 | 0.0005569 | 0.1036 | -0.001034 | 0.001149 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001182 | 0.000006732 | -0.1755 | -0.00001438 | 0.00001201 | fixed |
| male | 0.02491 | 0.005955 | 4.183 | 0.01324 | 0.03658 | fixed |
| sibling_count3 | 0.003041 | 0.008421 | 0.3611 | -0.01346 | 0.01955 | fixed |
| sibling_count4 | 0.02978 | 0.00946 | 3.148 | 0.01124 | 0.04832 | fixed |
| sibling_count5 | 0.02227 | 0.01122 | 1.984 | 0.0002712 | 0.04427 | fixed |
| sibling_count5+ | 0.0533 | 0.01018 | 5.234 | 0.03334 | 0.07327 | fixed |
| sd_(Intercept).mother_pidlink | 0.07007 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.175 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.01518 | 0.1201 | 0.1263 | -0.2203 | 0.2506 | fixed |
| birth_order | -0.001798 | 0.002186 | -0.8224 | -0.006082 | 0.002487 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.001049 | 0.01454 | -0.07217 | -0.02954 | 0.02745 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00006671 | 0.000557 | 0.1198 | -0.001025 | 0.001159 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001341 | 0.000006735 | -0.1991 | -0.00001454 | 0.00001186 | fixed |
| male | 0.02488 | 0.005956 | 4.178 | 0.01321 | 0.03656 | fixed |
| sibling_count3 | 0.003896 | 0.008485 | 0.4591 | -0.01273 | 0.02053 | fixed |
| sibling_count4 | 0.03179 | 0.00977 | 3.254 | 0.01264 | 0.05094 | fixed |
| sibling_count5 | 0.02563 | 0.01194 | 2.146 | 0.002219 | 0.04903 | fixed |
| sibling_count5+ | 0.0608 | 0.01367 | 4.448 | 0.03401 | 0.0876 | fixed |
| sd_(Intercept).mother_pidlink | 0.07 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1751 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.01003 | 0.1203 | 0.0834 | -0.2258 | 0.2459 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.00082 | 0.01455 | -0.05634 | -0.02935 | 0.02771 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00005832 | 0.0005576 | 0.1046 | -0.001035 | 0.001151 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001221 | 0.000006742 | -0.181 | -0.00001443 | 0.00001199 | fixed |
| male | 0.02492 | 0.00596 | 4.182 | 0.01324 | 0.0366 | fixed |
| sibling_count3 | 0.002344 | 0.008719 | 0.2688 | -0.01475 | 0.01943 | fixed |
| sibling_count4 | 0.03282 | 0.0103 | 3.186 | 0.01263 | 0.053 | fixed |
| sibling_count5 | 0.02701 | 0.01274 | 2.121 | 0.002048 | 0.05197 | fixed |
| sibling_count5+ | 0.05584 | 0.01442 | 3.871 | 0.02757 | 0.08411 | fixed |
| birth_order_nonlinear2 | 0.001738 | 0.007499 | 0.2318 | -0.01296 | 0.01644 | fixed |
| birth_order_nonlinear3 | 0.003074 | 0.009668 | 0.318 | -0.01587 | 0.02202 | fixed |
| birth_order_nonlinear4 | -0.01505 | 0.01247 | -1.206 | -0.03949 | 0.009398 | fixed |
| birth_order_nonlinear5 | -0.007201 | 0.01644 | -0.4379 | -0.03943 | 0.02503 | fixed |
| birth_order_nonlinear5+ | 0.001383 | 0.0171 | 0.0809 | -0.03214 | 0.0349 | fixed |
| sd_(Intercept).mother_pidlink | 0.07028 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.175 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.02475 | 0.1206 | 0.2052 | -0.2116 | 0.2611 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.002739 | 0.01459 | -0.1878 | -0.03133 | 0.02585 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001345 | 0.0005589 | 0.2407 | -0.0009609 | 0.00123 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000002188 | 0.000006758 | -0.3238 | -0.00001543 | 0.00001106 | fixed |
| male | 0.02456 | 0.005969 | 4.114 | 0.01286 | 0.03625 | fixed |
| count_birth_order2/2 | 0.004317 | 0.01246 | 0.3465 | -0.0201 | 0.02874 | fixed |
| count_birth_order1/3 | 0.003408 | 0.01118 | 0.3048 | -0.01851 | 0.02532 | fixed |
| count_birth_order2/3 | 0.006332 | 0.01223 | 0.5179 | -0.01763 | 0.03029 | fixed |
| count_birth_order3/3 | 0.004064 | 0.01367 | 0.2972 | -0.02274 | 0.03086 | fixed |
| count_birth_order1/4 | 0.03974 | 0.01488 | 2.671 | 0.01058 | 0.06891 | fixed |
| count_birth_order2/4 | 0.02834 | 0.0154 | 1.84 | -0.001853 | 0.05853 | fixed |
| count_birth_order3/4 | 0.02931 | 0.01621 | 1.808 | -0.002461 | 0.06109 | fixed |
| count_birth_order4/4 | 0.02599 | 0.01604 | 1.62 | -0.005454 | 0.05743 | fixed |
| count_birth_order1/5 | 0.00689 | 0.0216 | 0.319 | -0.03545 | 0.04923 | fixed |
| count_birth_order2/5 | 0.03487 | 0.02336 | 1.492 | -0.01092 | 0.08066 | fixed |
| count_birth_order3/5 | 0.0276 | 0.02126 | 1.298 | -0.01407 | 0.06927 | fixed |
| count_birth_order4/5 | 0.01066 | 0.01998 | 0.5339 | -0.02849 | 0.04982 | fixed |
| count_birth_order5/5 | 0.04122 | 0.02055 | 2.006 | 0.0009388 | 0.08151 | fixed |
| count_birth_order1/5+ | 0.07669 | 0.02748 | 2.791 | 0.02284 | 0.1305 | fixed |
| count_birth_order2/5+ | 0.05725 | 0.02663 | 2.15 | 0.005063 | 0.1094 | fixed |
| count_birth_order3/5+ | 0.09302 | 0.02448 | 3.799 | 0.04503 | 0.141 | fixed |
| count_birth_order4/5+ | 0.02899 | 0.02237 | 1.296 | -0.01484 | 0.07283 | fixed |
| count_birth_order5/5+ | 0.0316 | 0.01974 | 1.601 | -0.007081 | 0.07028 | fixed |
| count_birth_order5+/5+ | 0.05784 | 0.01354 | 4.272 | 0.0313 | 0.08438 | fixed |
| sd_(Intercept).mother_pidlink | 0.07014 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1751 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -1991 | -1922 | 1007 | -2013 | NA | NA | NA |
| 12 | -1990 | -1915 | 1007 | -2014 | 0.6787 | 1 | 0.41 |
| 16 | -1984 | -1883 | 1008 | -2016 | 1.76 | 4 | 0.7799 |
| 26 | -1971 | -1808 | 1012 | -2023 | 7.601 | 10 | 0.6677 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.0002828 | 0.1195 | 0.002366 | -0.234 | 0.2345 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0006424 | 0.01447 | 0.04439 | -0.02772 | 0.02901 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.000002017 | 0.0005547 | -0.003637 | -0.001089 | 0.001085 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000003936 | 0.000006707 | -0.05869 | -0.00001354 | 0.00001275 | fixed |
| male | 0.02545 | 0.005918 | 4.3 | 0.01385 | 0.03704 | fixed |
| sibling_count3 | -0.002779 | 0.009064 | -0.3066 | -0.02054 | 0.01499 | fixed |
| sibling_count4 | 0.02307 | 0.009816 | 2.35 | 0.003827 | 0.0423 | fixed |
| sibling_count5 | 0.02523 | 0.01087 | 2.321 | 0.003927 | 0.04653 | fixed |
| sibling_count5+ | 0.03975 | 0.009611 | 4.136 | 0.02091 | 0.05859 | fixed |
| sd_(Intercept).mother_pidlink | 0.07022 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1748 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.001055 | 0.1196 | 0.008822 | -0.2334 | 0.2355 | fixed |
| birth_order | -0.0003297 | 0.001834 | -0.1797 | -0.003925 | 0.003265 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.000602 | 0.01448 | 0.04159 | -0.02777 | 0.02897 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0000002517 | 0.0005548 | -0.0004536 | -0.001088 | 0.001087 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000000423 | 0.00000671 | -0.06305 | -0.00001357 | 0.00001273 | fixed |
| male | 0.02545 | 0.005918 | 4.299 | 0.01385 | 0.03705 | fixed |
| sibling_count3 | -0.002616 | 0.009111 | -0.2872 | -0.02047 | 0.01524 | fixed |
| sibling_count4 | 0.02343 | 0.01002 | 2.338 | 0.003786 | 0.04307 | fixed |
| sibling_count5 | 0.02579 | 0.01132 | 2.279 | 0.003612 | 0.04798 | fixed |
| sibling_count5+ | 0.04103 | 0.01196 | 3.43 | 0.01759 | 0.06447 | fixed |
| sd_(Intercept).mother_pidlink | 0.07023 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1748 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.00532 | 0.1198 | -0.04442 | -0.2401 | 0.2294 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.00107 | 0.01449 | 0.07384 | -0.02733 | 0.02947 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00001789 | 0.0005553 | -0.03221 | -0.001106 | 0.001071 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000001971 | 0.000006716 | -0.02934 | -0.00001336 | 0.00001297 | fixed |
| male | 0.02563 | 0.005921 | 4.329 | 0.01403 | 0.03724 | fixed |
| sibling_count3 | -0.002255 | 0.009346 | -0.2413 | -0.02057 | 0.01606 | fixed |
| sibling_count4 | 0.0258 | 0.0105 | 2.456 | 0.005212 | 0.04639 | fixed |
| sibling_count5 | 0.02825 | 0.01205 | 2.344 | 0.00463 | 0.05187 | fixed |
| sibling_count5+ | 0.03817 | 0.01249 | 3.057 | 0.0137 | 0.06264 | fixed |
| birth_order_nonlinear2 | 0.00555 | 0.007641 | 0.7263 | -0.009427 | 0.02053 | fixed |
| birth_order_nonlinear3 | -0.002217 | 0.009564 | -0.2318 | -0.02096 | 0.01653 | fixed |
| birth_order_nonlinear4 | -0.008889 | 0.01172 | -0.7585 | -0.03186 | 0.01408 | fixed |
| birth_order_nonlinear5 | 0.00004574 | 0.01522 | 0.003004 | -0.02979 | 0.02989 | fixed |
| birth_order_nonlinear5+ | 0.01021 | 0.01449 | 0.7042 | -0.0182 | 0.03861 | fixed |
| sd_(Intercept).mother_pidlink | 0.07045 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1747 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.001061 | 0.12 | 0.008841 | -0.2342 | 0.2363 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0001726 | 0.01452 | 0.01189 | -0.02828 | 0.02862 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00001582 | 0.0005564 | 0.02843 | -0.001075 | 0.001106 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000005898 | 0.000006729 | -0.08766 | -0.00001378 | 0.0000126 | fixed |
| male | 0.02548 | 0.005931 | 4.297 | 0.01386 | 0.03711 | fixed |
| count_birth_order2/2 | 0.008978 | 0.01357 | 0.6614 | -0.01763 | 0.03558 | fixed |
| count_birth_order1/3 | 0.003922 | 0.01206 | 0.3251 | -0.01972 | 0.02757 | fixed |
| count_birth_order2/3 | 0.0002864 | 0.01308 | 0.02189 | -0.02535 | 0.02592 | fixed |
| count_birth_order3/3 | -0.007098 | 0.01461 | -0.4859 | -0.03573 | 0.02153 | fixed |
| count_birth_order1/4 | 0.02279 | 0.01518 | 1.501 | -0.006973 | 0.05255 | fixed |
| count_birth_order2/4 | 0.02978 | 0.0153 | 1.946 | -0.0002105 | 0.05978 | fixed |
| count_birth_order3/4 | 0.01887 | 0.01703 | 1.108 | -0.01451 | 0.05225 | fixed |
| count_birth_order4/4 | 0.03166 | 0.01658 | 1.91 | -0.0008367 | 0.06416 | fixed |
| count_birth_order1/5 | 0.03335 | 0.01886 | 1.768 | -0.003614 | 0.07031 | fixed |
| count_birth_order2/5 | 0.04802 | 0.02126 | 2.259 | 0.006355 | 0.08968 | fixed |
| count_birth_order3/5 | 0.02118 | 0.01957 | 1.083 | -0.01716 | 0.05953 | fixed |
| count_birth_order4/5 | 0.01393 | 0.02002 | 0.6957 | -0.02531 | 0.05317 | fixed |
| count_birth_order5/5 | 0.02655 | 0.01963 | 1.353 | -0.01191 | 0.06502 | fixed |
| count_birth_order1/5+ | 0.02823 | 0.02007 | 1.407 | -0.01111 | 0.06756 | fixed |
| count_birth_order2/5+ | 0.0452 | 0.02232 | 2.025 | 0.001454 | 0.08894 | fixed |
| count_birth_order3/5+ | 0.06224 | 0.02072 | 3.003 | 0.02162 | 0.1029 | fixed |
| count_birth_order4/5+ | 0.01788 | 0.01865 | 0.9585 | -0.01868 | 0.05443 | fixed |
| count_birth_order5/5+ | 0.04218 | 0.01978 | 2.132 | 0.003409 | 0.08096 | fixed |
| count_birth_order5+/5+ | 0.04944 | 0.01289 | 3.835 | 0.02417 | 0.07471 | fixed |
| sd_(Intercept).mother_pidlink | 0.0702 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1749 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -2022 | -1953 | 1022 | -2044 | NA | NA | NA |
| 12 | -2020 | -1945 | 1022 | -2044 | 0.03257 | 1 | 0.8568 |
| 16 | -2015 | -1914 | 1023 | -2047 | 2.509 | 4 | 0.6429 |
| 26 | -2000 | -1837 | 1026 | -2052 | 5.464 | 10 | 0.8581 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.01789 | 0.1209 | 0.148 | -0.219 | 0.2548 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.001561 | 0.01463 | -0.1067 | -0.03023 | 0.02711 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00008934 | 0.0005601 | 0.1595 | -0.001008 | 0.001187 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001613 | 0.000006766 | -0.2384 | -0.00001487 | 0.00001165 | fixed |
| male | 0.02612 | 0.006023 | 4.337 | 0.01432 | 0.03793 | fixed |
| sibling_count3 | 0.0007046 | 0.008364 | 0.08425 | -0.01569 | 0.0171 | fixed |
| sibling_count4 | 0.021 | 0.009442 | 2.224 | 0.002494 | 0.03951 | fixed |
| sibling_count5 | 0.02668 | 0.01162 | 2.295 | 0.003894 | 0.04946 | fixed |
| sibling_count5+ | 0.05476 | 0.01044 | 5.245 | 0.03429 | 0.07522 | fixed |
| sd_(Intercept).mother_pidlink | 0.07021 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1751 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.02227 | 0.121 | 0.1841 | -0.2148 | 0.2594 | fixed |
| birth_order | -0.002079 | 0.00225 | -0.9241 | -0.006489 | 0.002331 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.001768 | 0.01463 | -0.1208 | -0.03044 | 0.02691 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00009948 | 0.0005602 | 0.1776 | -0.0009985 | 0.001197 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001796 | 0.000006769 | -0.2653 | -0.00001506 | 0.00001147 | fixed |
| male | 0.02607 | 0.006024 | 4.328 | 0.01427 | 0.03788 | fixed |
| sibling_count3 | 0.001673 | 0.008429 | 0.1985 | -0.01485 | 0.01819 | fixed |
| sibling_count4 | 0.02331 | 0.009766 | 2.387 | 0.004166 | 0.04245 | fixed |
| sibling_count5 | 0.03041 | 0.0123 | 2.471 | 0.006292 | 0.05452 | fixed |
| sibling_count5+ | 0.06342 | 0.01403 | 4.52 | 0.03592 | 0.09091 | fixed |
| sd_(Intercept).mother_pidlink | 0.07014 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1751 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.0182 | 0.1212 | 0.1502 | -0.2193 | 0.2557 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.001587 | 0.01465 | -0.1083 | -0.0303 | 0.02712 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00009018 | 0.0005608 | 0.1608 | -0.001009 | 0.001189 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001632 | 0.000006776 | -0.2409 | -0.00001491 | 0.00001165 | fixed |
| male | 0.02602 | 0.006028 | 4.317 | 0.01421 | 0.03784 | fixed |
| sibling_count3 | 0.000491 | 0.008668 | 0.05664 | -0.0165 | 0.01748 | fixed |
| sibling_count4 | 0.02332 | 0.01032 | 2.261 | 0.003102 | 0.04354 | fixed |
| sibling_count5 | 0.03303 | 0.01308 | 2.526 | 0.007402 | 0.05867 | fixed |
| sibling_count5+ | 0.0583 | 0.01491 | 3.911 | 0.02909 | 0.08751 | fixed |
| birth_order_nonlinear2 | 0.0002169 | 0.007492 | 0.02895 | -0.01447 | 0.0149 | fixed |
| birth_order_nonlinear3 | 0.001036 | 0.009708 | 0.1067 | -0.01799 | 0.02006 | fixed |
| birth_order_nonlinear4 | -0.01089 | 0.01288 | -0.8453 | -0.03615 | 0.01436 | fixed |
| birth_order_nonlinear5 | -0.019 | 0.01726 | -1.101 | -0.05282 | 0.01482 | fixed |
| birth_order_nonlinear5+ | 0.001732 | 0.01775 | 0.09756 | -0.03306 | 0.03653 | fixed |
| sd_(Intercept).mother_pidlink | 0.07048 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.175 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.03478 | 0.1215 | 0.2863 | -0.2034 | 0.2729 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.003973 | 0.01469 | -0.2706 | -0.03276 | 0.02481 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001861 | 0.0005623 | 0.3309 | -0.000916 | 0.001288 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000002854 | 0.000006796 | -0.4199 | -0.00001617 | 0.00001047 | fixed |
| male | 0.02537 | 0.006038 | 4.202 | 0.01354 | 0.0372 | fixed |
| count_birth_order2/2 | 0.007706 | 0.01212 | 0.6361 | -0.01604 | 0.03145 | fixed |
| count_birth_order1/3 | 0.004014 | 0.01111 | 0.3613 | -0.01776 | 0.02579 | fixed |
| count_birth_order2/3 | 0.003202 | 0.01236 | 0.2591 | -0.02102 | 0.02742 | fixed |
| count_birth_order3/3 | 0.002463 | 0.01358 | 0.1813 | -0.02416 | 0.02909 | fixed |
| count_birth_order1/4 | 0.03037 | 0.01504 | 2.02 | 0.0009027 | 0.05984 | fixed |
| count_birth_order2/4 | 0.02255 | 0.0155 | 1.455 | -0.007823 | 0.05292 | fixed |
| count_birth_order3/4 | 0.0205 | 0.01592 | 1.287 | -0.01071 | 0.05171 | fixed |
| count_birth_order4/4 | 0.02008 | 0.01627 | 1.234 | -0.01181 | 0.05197 | fixed |
| count_birth_order1/5 | 0.01887 | 0.0217 | 0.8697 | -0.02365 | 0.06139 | fixed |
| count_birth_order2/5 | 0.03535 | 0.02463 | 1.435 | -0.01292 | 0.08362 | fixed |
| count_birth_order3/5 | 0.03267 | 0.02251 | 1.451 | -0.01145 | 0.07679 | fixed |
| count_birth_order4/5 | 0.02488 | 0.02104 | 1.183 | -0.01634 | 0.06611 | fixed |
| count_birth_order5/5 | 0.03749 | 0.02189 | 1.713 | -0.005409 | 0.08038 | fixed |
| count_birth_order1/5+ | 0.09729 | 0.02792 | 3.485 | 0.04258 | 0.152 | fixed |
| count_birth_order2/5+ | 0.04167 | 0.02754 | 1.513 | -0.01231 | 0.09565 | fixed |
| count_birth_order3/5+ | 0.09556 | 0.0262 | 3.647 | 0.04421 | 0.1469 | fixed |
| count_birth_order4/5+ | 0.03713 | 0.02435 | 1.525 | -0.01058 | 0.08485 | fixed |
| count_birth_order5/5+ | 0.02453 | 0.0205 | 1.197 | -0.01565 | 0.06472 | fixed |
| count_birth_order5+/5+ | 0.06231 | 0.01387 | 4.493 | 0.03513 | 0.08949 | fixed |
| sd_(Intercept).mother_pidlink | 0.07055 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.175 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -1946 | -1877 | 984.1 | -1968 | NA | NA | NA |
| 12 | -1945 | -1870 | 984.5 | -1969 | 0.857 | 1 | 0.3546 |
| 16 | -1938 | -1838 | 985.2 | -1970 | 1.428 | 4 | 0.8393 |
| 26 | -1927 | -1764 | 989.3 | -1979 | 8.208 | 10 | 0.6085 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = attended_school)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.968 | 0.01706 | 115.4 | 1.935 | 2.002 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.002032 | 0.001622 | 1.253 | -0.001146 | 0.00521 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00002256 | 0.00004725 | -0.4774 | -0.0001152 | 0.00007005 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000005908 | 0.0000004301 | -1.374 | -0.000001434 | 0.0000002522 | fixed |
| male | 0.0045 | 0.00183 | 2.459 | 0.0009138 | 0.008086 | fixed |
| sibling_count3 | -0.0003612 | 0.00372 | -0.09709 | -0.007653 | 0.00693 | fixed |
| sibling_count4 | -0.0006508 | 0.003832 | -0.1698 | -0.008161 | 0.00686 | fixed |
| sibling_count5 | 0.003564 | 0.004005 | 0.8899 | -0.004285 | 0.01141 | fixed |
| sibling_count5+ | -0.003767 | 0.003134 | -1.202 | -0.00991 | 0.002375 | fixed |
| sd_(Intercept).mother_pidlink | 0.04 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1049 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.968 | 0.01706 | 115.4 | 1.935 | 2.002 | fixed |
| birth_order | 0.0003991 | 0.0003879 | 1.029 | -0.0003612 | 0.001159 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.001915 | 0.001626 | 1.178 | -0.001271 | 0.005101 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00001828 | 0.00004743 | -0.3854 | -0.0001113 | 0.00007469 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000006301 | 0.0000004318 | -1.459 | -0.000001476 | 0.0000002162 | fixed |
| male | 0.00449 | 0.00183 | 2.454 | 0.0009035 | 0.008076 | fixed |
| sibling_count3 | -0.0004555 | 0.003722 | -0.1224 | -0.00775 | 0.006839 | fixed |
| sibling_count4 | -0.0009254 | 0.003842 | -0.2409 | -0.008455 | 0.006604 | fixed |
| sibling_count5 | 0.003088 | 0.004032 | 0.7659 | -0.004814 | 0.01099 | fixed |
| sibling_count5+ | -0.005271 | 0.003458 | -1.524 | -0.01205 | 0.001507 | fixed |
| sd_(Intercept).mother_pidlink | 0.04003 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1049 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.965 | 0.0171 | 115 | 1.932 | 1.999 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.001958 | 0.001626 | 1.204 | -0.001229 | 0.005144 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00002171 | 0.00004743 | -0.4577 | -0.0001147 | 0.00007126 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000000577 | 0.0000004318 | -1.336 | -0.000001423 | 0.0000002694 | fixed |
| male | 0.004508 | 0.001829 | 2.464 | 0.0009228 | 0.008093 | fixed |
| sibling_count3 | -0.0008396 | 0.003773 | -0.2226 | -0.008234 | 0.006554 | fixed |
| sibling_count4 | -0.001915 | 0.003947 | -0.4851 | -0.009651 | 0.005821 | fixed |
| sibling_count5 | 0.002337 | 0.004181 | 0.5589 | -0.005858 | 0.01053 | fixed |
| sibling_count5+ | -0.005684 | 0.003629 | -1.566 | -0.0128 | 0.00143 | fixed |
| birth_order_nonlinear2 | 0.009478 | 0.002651 | 3.576 | 0.004282 | 0.01467 | fixed |
| birth_order_nonlinear3 | 0.004998 | 0.00312 | 1.602 | -0.001118 | 0.01111 | fixed |
| birth_order_nonlinear4 | 0.00704 | 0.003569 | 1.972 | 0.00004392 | 0.01404 | fixed |
| birth_order_nonlinear5 | 0.00423 | 0.00406 | 1.042 | -0.003728 | 0.01219 | fixed |
| birth_order_nonlinear5+ | 0.006468 | 0.003369 | 1.92 | -0.0001353 | 0.01307 | fixed |
| sd_(Intercept).mother_pidlink | 0.04003 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1049 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.964 | 0.01717 | 114.3 | 1.93 | 1.997 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.001951 | 0.001626 | 1.2 | -0.001236 | 0.005139 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00002194 | 0.00004745 | -0.4624 | -0.0001149 | 0.00007106 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000005714 | 0.0000004321 | -1.322 | -0.000001418 | 0.0000002755 | fixed |
| male | 0.004513 | 0.00183 | 2.466 | 0.0009264 | 0.0081 | fixed |
| count_birth_order2/2 | 0.01457 | 0.005155 | 2.826 | 0.004466 | 0.02467 | fixed |
| count_birth_order1/3 | 0.003496 | 0.004912 | 0.7117 | -0.006132 | 0.01312 | fixed |
| count_birth_order2/3 | 0.006761 | 0.005492 | 1.231 | -0.004004 | 0.01753 | fixed |
| count_birth_order3/3 | 0.006183 | 0.006121 | 1.01 | -0.005814 | 0.01818 | fixed |
| count_birth_order1/4 | -0.001403 | 0.00556 | -0.2522 | -0.0123 | 0.009496 | fixed |
| count_birth_order2/4 | 0.00841 | 0.005915 | 1.422 | -0.003185 | 0.02 | fixed |
| count_birth_order3/4 | 0.007888 | 0.006414 | 1.23 | -0.004684 | 0.02046 | fixed |
| count_birth_order4/4 | 0.00767 | 0.006728 | 1.14 | -0.005515 | 0.02086 | fixed |
| count_birth_order1/5 | 0.003475 | 0.006362 | 0.5463 | -0.008993 | 0.01594 | fixed |
| count_birth_order2/5 | 0.0146 | 0.006711 | 2.175 | 0.001442 | 0.02775 | fixed |
| count_birth_order3/5 | 0.009876 | 0.006864 | 1.439 | -0.003577 | 0.02333 | fixed |
| count_birth_order4/5 | 0.01004 | 0.007349 | 1.367 | -0.00436 | 0.02445 | fixed |
| count_birth_order5/5 | 0.00893 | 0.007486 | 1.193 | -0.005743 | 0.0236 | fixed |
| count_birth_order1/5+ | -0.002407 | 0.005119 | -0.4702 | -0.01244 | 0.007626 | fixed |
| count_birth_order2/5+ | 0.006208 | 0.005288 | 1.174 | -0.004157 | 0.01657 | fixed |
| count_birth_order3/5+ | -0.0006546 | 0.005174 | -0.1265 | -0.0108 | 0.009487 | fixed |
| count_birth_order4/5+ | 0.003439 | 0.005098 | 0.6747 | -0.006552 | 0.01343 | fixed |
| count_birth_order5/5+ | 0.0002875 | 0.005118 | 0.05618 | -0.009743 | 0.01032 | fixed |
| count_birth_order5+/5+ | 0.002677 | 0.00402 | 0.6661 | -0.005201 | 0.01056 | fixed |
| sd_(Intercept).mother_pidlink | 0.04003 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1049 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -22818 | -22735 | 11420 | -22840 | NA | NA | NA |
| 12 | -22817 | -22726 | 11421 | -22841 | 1.058 | 1 | 0.3037 |
| 16 | -22822 | -22701 | 11427 | -22854 | 12.65 | 4 | 0.01311 |
| 26 | -22805 | -22608 | 11429 | -22857 | 3.176 | 10 | 0.977 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.011 | 0.02852 | 70.53 | 1.955 | 2.067 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.001947 | 0.003235 | -0.6018 | -0.008288 | 0.004394 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0000824 | 0.0001155 | 0.7134 | -0.000144 | 0.0003088 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001031 | 0.000001309 | -0.7881 | -0.000003597 | 0.000001534 | fixed |
| male | 0.0001955 | 0.001662 | 0.1176 | -0.003062 | 0.003453 | fixed |
| sibling_count3 | -0.0003751 | 0.002516 | -0.1491 | -0.005307 | 0.004557 | fixed |
| sibling_count4 | -0.001316 | 0.002683 | -0.4904 | -0.006575 | 0.003943 | fixed |
| sibling_count5 | -0.003354 | 0.003057 | -1.097 | -0.009345 | 0.002636 | fixed |
| sibling_count5+ | -0.006361 | 0.002651 | -2.399 | -0.01156 | -0.001165 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.0656 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.012 | 0.02852 | 70.55 | 1.956 | 2.068 | fixed |
| birth_order | -0.0007748 | 0.00054 | -1.435 | -0.001833 | 0.0002837 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.001931 | 0.003235 | -0.5969 | -0.008272 | 0.00441 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00008326 | 0.0001155 | 0.7209 | -0.0001431 | 0.0003096 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00000107 | 0.000001309 | -0.8174 | -0.000003636 | 0.000001496 | fixed |
| male | 0.0002228 | 0.001662 | 0.1341 | -0.003034 | 0.00348 | fixed |
| sibling_count3 | 0.00000391 | 0.00253 | 0.001546 | -0.004955 | 0.004962 | fixed |
| sibling_count4 | -0.0004532 | 0.002749 | -0.1648 | -0.005842 | 0.004936 | fixed |
| sibling_count5 | -0.001941 | 0.003211 | -0.6046 | -0.008235 | 0.004352 | fixed |
| sibling_count5+ | -0.003485 | 0.003324 | -1.048 | -0.009999 | 0.00303 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.0656 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.015 | 0.02855 | 70.56 | 1.959 | 2.071 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.002183 | 0.003236 | -0.6745 | -0.008526 | 0.00416 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00009152 | 0.0001155 | 0.7921 | -0.0001349 | 0.000318 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001145 | 0.00000131 | -0.8742 | -0.000003712 | 0.000001422 | fixed |
| male | 0.0001161 | 0.001662 | 0.06984 | -0.003141 | 0.003373 | fixed |
| sibling_count3 | -0.0003986 | 0.00259 | -0.1539 | -0.005476 | 0.004678 | fixed |
| sibling_count4 | -0.00217 | 0.002874 | -0.7549 | -0.007803 | 0.003464 | fixed |
| sibling_count5 | -0.00477 | 0.0034 | -1.403 | -0.01143 | 0.001894 | fixed |
| sibling_count5+ | -0.006043 | 0.003442 | -1.756 | -0.01279 | 0.0007036 | fixed |
| birth_order_nonlinear2 | -0.005037 | 0.002194 | -2.296 | -0.009336 | -0.0007372 | fixed |
| birth_order_nonlinear3 | -0.0001685 | 0.002691 | -0.06262 | -0.005444 | 0.005107 | fixed |
| birth_order_nonlinear4 | 0.002693 | 0.003327 | 0.8095 | -0.003828 | 0.009215 | fixed |
| birth_order_nonlinear5 | 0.0002744 | 0.004181 | 0.06563 | -0.00792 | 0.008469 | fixed |
| birth_order_nonlinear5+ | -0.004911 | 0.00408 | -1.204 | -0.01291 | 0.003085 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.06558 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.014 | 0.02858 | 70.47 | 1.958 | 2.071 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.00219 | 0.00324 | -0.6758 | -0.00854 | 0.00416 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00009155 | 0.0001157 | 0.7913 | -0.0001352 | 0.0003183 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001146 | 0.000001312 | -0.8737 | -0.000003717 | 0.000001425 | fixed |
| male | 0.0001459 | 0.001662 | 0.08779 | -0.003111 | 0.003403 | fixed |
| count_birth_order2/2 | -0.003615 | 0.003935 | -0.9188 | -0.01133 | 0.004096 | fixed |
| count_birth_order1/3 | -0.0004489 | 0.003422 | -0.1312 | -0.007157 | 0.006259 | fixed |
| count_birth_order2/3 | -0.004972 | 0.003731 | -1.333 | -0.01228 | 0.00234 | fixed |
| count_birth_order3/3 | 0.0009987 | 0.004173 | 0.2393 | -0.00718 | 0.009177 | fixed |
| count_birth_order1/4 | -0.001972 | 0.004172 | -0.4727 | -0.01015 | 0.006204 | fixed |
| count_birth_order2/4 | -0.005412 | 0.004322 | -1.252 | -0.01388 | 0.003059 | fixed |
| count_birth_order3/4 | 0.000761 | 0.00458 | 0.1662 | -0.008216 | 0.009738 | fixed |
| count_birth_order4/4 | -0.003091 | 0.004762 | -0.6492 | -0.01242 | 0.006241 | fixed |
| count_birth_order1/5 | -0.005454 | 0.005692 | -0.9582 | -0.01661 | 0.005702 | fixed |
| count_birth_order2/5 | -0.02171 | 0.006134 | -3.539 | -0.03373 | -0.009688 | fixed |
| count_birth_order3/5 | 0.0004959 | 0.00569 | 0.08716 | -0.01066 | 0.01165 | fixed |
| count_birth_order4/5 | 0.0006201 | 0.005594 | 0.1109 | -0.01034 | 0.01158 | fixed |
| count_birth_order5/5 | 0.0007406 | 0.005808 | 0.1275 | -0.01064 | 0.01212 | fixed |
| count_birth_order1/5+ | 0.0007324 | 0.00565 | 0.1296 | -0.01034 | 0.01181 | fixed |
| count_birth_order2/5+ | -0.005395 | 0.005634 | -0.9577 | -0.01644 | 0.005647 | fixed |
| count_birth_order3/5+ | -0.01633 | 0.005546 | -2.945 | -0.0272 | -0.005465 | fixed |
| count_birth_order4/5+ | 0.0004021 | 0.005225 | 0.07696 | -0.009838 | 0.01064 | fixed |
| count_birth_order5/5+ | -0.00845 | 0.005 | -1.69 | -0.01825 | 0.00135 | fixed |
| count_birth_order5+/5+ | -0.01044 | 0.003679 | -2.838 | -0.01765 | -0.003229 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.06554 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -16291 | -16217 | 8157 | -16313 | NA | NA | NA |
| 12 | -16291 | -16210 | 8158 | -16315 | 2.061 | 1 | 0.1511 |
| 16 | -16291 | -16183 | 8161 | -16323 | 7.77 | 4 | 0.1004 |
| 26 | -16288 | -16113 | 8170 | -16340 | 16.98 | 10 | 0.07483 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.012 | 0.02829 | 71.11 | 1.956 | 2.067 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.001995 | 0.003211 | -0.6213 | -0.008289 | 0.004299 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00008284 | 0.0001147 | 0.7224 | -0.0001419 | 0.0003076 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001035 | 0.0000013 | -0.7966 | -0.000003583 | 0.000001512 | fixed |
| male | 0.0001628 | 0.001648 | 0.09879 | -0.003067 | 0.003392 | fixed |
| sibling_count3 | -0.0002068 | 0.002719 | -0.07605 | -0.005537 | 0.005123 | fixed |
| sibling_count4 | -0.00003864 | 0.002839 | -0.01361 | -0.005603 | 0.005526 | fixed |
| sibling_count5 | -0.001917 | 0.003027 | -0.6333 | -0.007849 | 0.004016 | fixed |
| sibling_count5+ | -0.00446 | 0.002648 | -1.684 | -0.009651 | 0.0007303 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.06532 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.012 | 0.02829 | 71.12 | 1.957 | 2.068 | fixed |
| birth_order | -0.0006005 | 0.0004664 | -1.288 | -0.001515 | 0.0003136 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.002002 | 0.003211 | -0.6233 | -0.008296 | 0.004292 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00008416 | 0.0001147 | 0.7339 | -0.0001406 | 0.0003089 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001072 | 0.0000013 | -0.8247 | -0.00000362 | 0.000001476 | fixed |
| male | 0.000178 | 0.001648 | 0.108 | -0.003051 | 0.003408 | fixed |
| sibling_count3 | 0.00008331 | 0.002729 | 0.03053 | -0.005265 | 0.005431 | fixed |
| sibling_count4 | 0.0006008 | 0.002882 | 0.2085 | -0.005048 | 0.00625 | fixed |
| sibling_count5 | -0.0009089 | 0.003126 | -0.2907 | -0.007036 | 0.005218 | fixed |
| sibling_count5+ | -0.002282 | 0.003142 | -0.7263 | -0.008441 | 0.003877 | fixed |
| sd_(Intercept).mother_pidlink | 0.000000006072 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.06532 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.015 | 0.02832 | 71.17 | 1.96 | 2.071 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.002241 | 0.003211 | -0.6979 | -0.008535 | 0.004053 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00009272 | 0.0001147 | 0.8084 | -0.0001321 | 0.0003175 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001162 | 0.0000013 | -0.8934 | -0.00000371 | 0.000001387 | fixed |
| male | 0.00009342 | 0.001647 | 0.05671 | -0.003135 | 0.003322 | fixed |
| sibling_count3 | -0.0001752 | 0.002785 | -0.06292 | -0.005633 | 0.005283 | fixed |
| sibling_count4 | -0.0005815 | 0.002996 | -0.1941 | -0.006453 | 0.00529 | fixed |
| sibling_count5 | -0.003249 | 0.003294 | -0.9863 | -0.009706 | 0.003208 | fixed |
| sibling_count5+ | -0.003948 | 0.003257 | -1.212 | -0.01033 | 0.002435 | fixed |
| birth_order_nonlinear2 | -0.005297 | 0.00222 | -2.386 | -0.009649 | -0.000946 | fixed |
| birth_order_nonlinear3 | -0.0005044 | 0.002664 | -0.1893 | -0.005726 | 0.004717 | fixed |
| birth_order_nonlinear4 | 0.001782 | 0.003203 | 0.5562 | -0.004497 | 0.00806 | fixed |
| birth_order_nonlinear5 | 0.001802 | 0.003933 | 0.4582 | -0.005906 | 0.00951 | fixed |
| birth_order_nonlinear5+ | -0.005815 | 0.003619 | -1.607 | -0.01291 | 0.001278 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.06529 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.015 | 0.02836 | 71.05 | 1.959 | 2.071 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.002231 | 0.003215 | -0.694 | -0.008532 | 0.00407 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00009229 | 0.0001148 | 0.8037 | -0.0001328 | 0.0003174 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001156 | 0.000001302 | -0.8876 | -0.000003708 | 0.000001396 | fixed |
| male | 0.0001064 | 0.001648 | 0.06454 | -0.003123 | 0.003336 | fixed |
| count_birth_order2/2 | -0.004276 | 0.004292 | -0.9963 | -0.01269 | 0.004136 | fixed |
| count_birth_order1/3 | -0.0003683 | 0.003692 | -0.09976 | -0.007605 | 0.006868 | fixed |
| count_birth_order2/3 | -0.00554 | 0.004017 | -1.379 | -0.01341 | 0.002334 | fixed |
| count_birth_order3/3 | 0.001302 | 0.004497 | 0.2896 | -0.007511 | 0.01012 | fixed |
| count_birth_order1/4 | -0.001762 | 0.004341 | -0.406 | -0.01027 | 0.006746 | fixed |
| count_birth_order2/4 | -0.001991 | 0.004433 | -0.4491 | -0.01068 | 0.006698 | fixed |
| count_birth_order3/4 | 0.0011 | 0.004877 | 0.2256 | -0.008458 | 0.01066 | fixed |
| count_birth_order4/4 | -0.003243 | 0.005046 | -0.6427 | -0.01313 | 0.006647 | fixed |
| count_birth_order1/5 | -0.003534 | 0.005172 | -0.6833 | -0.01367 | 0.006603 | fixed |
| count_birth_order2/5 | -0.01611 | 0.005572 | -2.891 | -0.02703 | -0.00519 | fixed |
| count_birth_order3/5 | 0.0009379 | 0.005428 | 0.1728 | -0.009702 | 0.01158 | fixed |
| count_birth_order4/5 | 0.001 | 0.005696 | 0.1756 | -0.01016 | 0.01216 | fixed |
| count_birth_order5/5 | 0.001112 | 0.005673 | 0.196 | -0.01001 | 0.01223 | fixed |
| count_birth_order1/5+ | 0.001216 | 0.00493 | 0.2466 | -0.008447 | 0.01088 | fixed |
| count_birth_order2/5+ | -0.008076 | 0.005152 | -1.568 | -0.01817 | 0.002021 | fixed |
| count_birth_order3/5+ | -0.01154 | 0.005022 | -2.297 | -0.02138 | -0.001693 | fixed |
| count_birth_order4/5+ | 0.0009338 | 0.004821 | 0.1937 | -0.008515 | 0.01038 | fixed |
| count_birth_order5/5+ | -0.003345 | 0.00499 | -0.6702 | -0.01313 | 0.006436 | fixed |
| count_birth_order5+/5+ | -0.009414 | 0.003609 | -2.609 | -0.01649 | -0.002341 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.06528 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -16498 | -16423 | 8260 | -16520 | NA | NA | NA |
| 12 | -16497 | -16416 | 8261 | -16521 | 1.66 | 1 | 0.1976 |
| 16 | -16499 | -16391 | 8266 | -16531 | 9.831 | 4 | 0.04338 |
| 26 | -16491 | -16315 | 8271 | -16543 | 11.8 | 10 | 0.2989 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.018 | 0.02859 | 70.59 | 1.962 | 2.074 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.00255 | 0.003245 | -0.7858 | -0.00891 | 0.00381 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001017 | 0.0001159 | 0.8777 | -0.0001254 | 0.0003288 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00000123 | 0.000001314 | -0.936 | -0.000003805 | 0.000001345 | fixed |
| male | -0.00009463 | 0.001664 | -0.05687 | -0.003356 | 0.003167 | fixed |
| sibling_count3 | -0.001208 | 0.00246 | -0.4911 | -0.006031 | 0.003614 | fixed |
| sibling_count4 | -0.003839 | 0.002643 | -1.452 | -0.00902 | 0.001341 | fixed |
| sibling_count5 | -0.003218 | 0.003094 | -1.04 | -0.009281 | 0.002845 | fixed |
| sibling_count5+ | -0.006981 | 0.002649 | -2.636 | -0.01217 | -0.00179 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.06502 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.019 | 0.02859 | 70.6 | 1.962 | 2.075 | fixed |
| birth_order | -0.0006737 | 0.0005522 | -1.22 | -0.001756 | 0.0004086 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.002525 | 0.003245 | -0.778 | -0.008884 | 0.003835 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001021 | 0.0001159 | 0.8812 | -0.000125 | 0.0003292 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00000126 | 0.000001314 | -0.9586 | -0.000003835 | 0.000001316 | fixed |
| male | -0.0000827 | 0.001664 | -0.0497 | -0.003344 | 0.003178 | fixed |
| sibling_count3 | -0.0008808 | 0.002475 | -0.3559 | -0.005732 | 0.00397 | fixed |
| sibling_count4 | -0.0031 | 0.002712 | -1.143 | -0.008415 | 0.002215 | fixed |
| sibling_count5 | -0.002043 | 0.00324 | -0.6306 | -0.008393 | 0.004307 | fixed |
| sibling_count5+ | -0.004499 | 0.00334 | -1.347 | -0.01104 | 0.002047 | fixed |
| sd_(Intercept).mother_pidlink | 0.000000005224 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.06501 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.021 | 0.02862 | 70.62 | 1.965 | 2.077 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.002776 | 0.003246 | -0.8553 | -0.009138 | 0.003585 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001105 | 0.0001159 | 0.9533 | -0.0001167 | 0.0003377 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001342 | 0.000001315 | -1.021 | -0.000003918 | 0.000001235 | fixed |
| male | -0.0001589 | 0.001664 | -0.0955 | -0.00342 | 0.003102 | fixed |
| sibling_count3 | -0.001365 | 0.002536 | -0.5382 | -0.006336 | 0.003606 | fixed |
| sibling_count4 | -0.004754 | 0.002838 | -1.675 | -0.01032 | 0.0008094 | fixed |
| sibling_count5 | -0.003792 | 0.003416 | -1.11 | -0.01049 | 0.002903 | fixed |
| sibling_count5+ | -0.006122 | 0.003464 | -1.768 | -0.01291 | 0.0006664 | fixed |
| birth_order_nonlinear2 | -0.004324 | 0.002171 | -1.992 | -0.008579 | -0.0000701 | fixed |
| birth_order_nonlinear3 | 0.0001426 | 0.002671 | 0.05338 | -0.005093 | 0.005378 | fixed |
| birth_order_nonlinear4 | 0.00281 | 0.003394 | 0.828 | -0.003842 | 0.009463 | fixed |
| birth_order_nonlinear5 | -0.004068 | 0.004315 | -0.9426 | -0.01253 | 0.00439 | fixed |
| birth_order_nonlinear5+ | -0.004234 | 0.004176 | -1.014 | -0.01242 | 0.003951 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.065 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.021 | 0.02867 | 70.5 | 1.965 | 2.077 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.002721 | 0.003251 | -0.8371 | -0.009092 | 0.00365 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001088 | 0.0001161 | 0.9369 | -0.0001188 | 0.0003363 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001325 | 0.000001317 | -1.006 | -0.000003906 | 0.000001257 | fixed |
| male | -0.00008317 | 0.001664 | -0.04997 | -0.003345 | 0.003179 | fixed |
| count_birth_order2/2 | -0.004503 | 0.003796 | -1.186 | -0.01194 | 0.002937 | fixed |
| count_birth_order1/3 | -0.001611 | 0.003351 | -0.4808 | -0.00818 | 0.004957 | fixed |
| count_birth_order2/3 | -0.00631 | 0.0037 | -1.705 | -0.01356 | 0.0009425 | fixed |
| count_birth_order3/3 | -0.0002261 | 0.004069 | -0.05556 | -0.0082 | 0.007748 | fixed |
| count_birth_order1/4 | -0.008884 | 0.004156 | -2.137 | -0.01703 | -0.0007379 | fixed |
| count_birth_order2/4 | -0.006667 | 0.004294 | -1.552 | -0.01508 | 0.00175 | fixed |
| count_birth_order3/4 | -0.0003684 | 0.004503 | -0.08182 | -0.009195 | 0.008458 | fixed |
| count_birth_order4/4 | -0.004377 | 0.004758 | -0.9199 | -0.0137 | 0.004948 | fixed |
| count_birth_order1/5 | -0.0004467 | 0.005644 | -0.07915 | -0.01151 | 0.01061 | fixed |
| count_birth_order2/5 | -0.01668 | 0.006279 | -2.656 | -0.02898 | -0.00437 | fixed |
| count_birth_order3/5 | -0.0006599 | 0.005896 | -0.1119 | -0.01222 | 0.0109 | fixed |
| count_birth_order4/5 | -0.000488 | 0.0058 | -0.08414 | -0.01186 | 0.01088 | fixed |
| count_birth_order5/5 | -0.008039 | 0.006139 | -1.309 | -0.02007 | 0.003993 | fixed |
| count_birth_order1/5+ | -0.0002868 | 0.005746 | -0.04992 | -0.01155 | 0.01097 | fixed |
| count_birth_order2/5+ | -0.006855 | 0.005725 | -1.197 | -0.01808 | 0.004366 | fixed |
| count_birth_order3/5+ | -0.01792 | 0.005558 | -3.225 | -0.02882 | -0.007029 | fixed |
| count_birth_order4/5+ | -0.0006839 | 0.005444 | -0.1256 | -0.01135 | 0.009987 | fixed |
| count_birth_order5/5+ | -0.0102 | 0.005072 | -2.011 | -0.02014 | -0.0002581 | fixed |
| count_birth_order5+/5+ | -0.01043 | 0.003711 | -2.812 | -0.01771 | -0.00316 | fixed |
| sd_(Intercept).mother_pidlink | 0.00000002054 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.06498 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -16083 | -16009 | 8052 | -16105 | NA | NA | NA |
| 12 | -16082 | -16002 | 8053 | -16106 | 1.491 | 1 | 0.2221 |
| 16 | -16081 | -15974 | 8057 | -16113 | 6.603 | 4 | 0.1584 |
| 26 | -16075 | -15901 | 8064 | -16127 | 14.38 | 10 | 0.1565 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = wage_last_month_z)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.166 | 0.3787 | -5.72 | -2.909 | -1.424 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1631 | 0.03571 | 4.567 | 0.09308 | 0.233 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003976 | 0.001063 | -3.739 | -0.00606 | -0.001892 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003055 | 0.00001006 | 3.036 | 0.00001083 | 0.00005027 | fixed |
| male | 0.1388 | 0.02631 | 5.276 | 0.08727 | 0.1904 | fixed |
| sibling_count3 | 0.1019 | 0.05214 | 1.954 | -0.0003369 | 0.204 | fixed |
| sibling_count4 | 0.05405 | 0.05208 | 1.038 | -0.04802 | 0.1561 | fixed |
| sibling_count5 | 0.05158 | 0.05423 | 0.9512 | -0.0547 | 0.1579 | fixed |
| sibling_count5+ | -0.003651 | 0.04276 | -0.08539 | -0.08745 | 0.08015 | fixed |
| sd_(Intercept).mother_pidlink | 0.2708 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.95 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.15 | 0.3789 | -5.675 | -2.892 | -1.407 | fixed |
| birth_order | 0.007971 | 0.005175 | 1.54 | -0.002171 | 0.01811 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1595 | 0.03578 | 4.457 | 0.08934 | 0.2296 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003854 | 0.001066 | -3.615 | -0.005943 | -0.001764 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000294 | 0.00001009 | 2.914 | 0.000009629 | 0.00004917 | fixed |
| male | 0.1384 | 0.02631 | 5.26 | 0.08684 | 0.19 | fixed |
| sibling_count3 | 0.0995 | 0.05217 | 1.907 | -0.002746 | 0.2017 | fixed |
| sibling_count4 | 0.04798 | 0.05223 | 0.9185 | -0.0544 | 0.1504 | fixed |
| sibling_count5 | 0.04152 | 0.05463 | 0.7601 | -0.06554 | 0.1486 | fixed |
| sibling_count5+ | -0.03363 | 0.04698 | -0.7158 | -0.1257 | 0.05845 | fixed |
| sd_(Intercept).mother_pidlink | 0.2729 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9493 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.148 | 0.3795 | -5.66 | -2.892 | -1.404 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1602 | 0.03579 | 4.475 | 0.09002 | 0.2303 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003894 | 0.001067 | -3.65 | -0.005985 | -0.001803 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002995 | 0.0000101 | 2.965 | 0.00001015 | 0.00004975 | fixed |
| male | 0.1388 | 0.02631 | 5.274 | 0.08721 | 0.1904 | fixed |
| sibling_count3 | 0.09578 | 0.05293 | 1.809 | -0.007966 | 0.1995 | fixed |
| sibling_count4 | 0.03642 | 0.05393 | 0.6753 | -0.06928 | 0.1421 | fixed |
| sibling_count5 | 0.01732 | 0.05692 | 0.3043 | -0.09424 | 0.1289 | fixed |
| sibling_count5+ | -0.04504 | 0.0495 | -0.9099 | -0.1421 | 0.05198 | fixed |
| birth_order_nonlinear2 | 0.02294 | 0.03805 | 0.6028 | -0.05164 | 0.09751 | fixed |
| birth_order_nonlinear3 | 0.03579 | 0.04407 | 0.8122 | -0.05058 | 0.1222 | fixed |
| birth_order_nonlinear4 | 0.07121 | 0.04928 | 1.445 | -0.02536 | 0.1678 | fixed |
| birth_order_nonlinear5 | 0.1192 | 0.05594 | 2.131 | 0.009576 | 0.2288 | fixed |
| birth_order_nonlinear5+ | 0.0531 | 0.04599 | 1.155 | -0.03705 | 0.1433 | fixed |
| sd_(Intercept).mother_pidlink | 0.2737 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9492 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.12 | 0.3809 | -5.565 | -2.866 | -1.373 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1581 | 0.03585 | 4.409 | 0.0878 | 0.2283 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00382 | 0.001069 | -3.574 | -0.005915 | -0.001725 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002915 | 0.00001012 | 2.88 | 0.000009315 | 0.00004899 | fixed |
| male | 0.1379 | 0.02635 | 5.235 | 0.0863 | 0.1896 | fixed |
| count_birth_order2/2 | -0.006871 | 0.07714 | -0.08907 | -0.1581 | 0.1443 | fixed |
| count_birth_order1/3 | 0.1024 | 0.06942 | 1.475 | -0.03367 | 0.2384 | fixed |
| count_birth_order2/3 | 0.08335 | 0.0791 | 1.054 | -0.07168 | 0.2384 | fixed |
| count_birth_order3/3 | 0.1205 | 0.08859 | 1.361 | -0.05309 | 0.2942 | fixed |
| count_birth_order1/4 | 0.06485 | 0.07708 | 0.8413 | -0.08622 | 0.2159 | fixed |
| count_birth_order2/4 | 0.08698 | 0.08249 | 1.054 | -0.0747 | 0.2487 | fixed |
| count_birth_order3/4 | -0.04521 | 0.08657 | -0.5222 | -0.2149 | 0.1245 | fixed |
| count_birth_order4/4 | 0.108 | 0.09454 | 1.142 | -0.07732 | 0.2933 | fixed |
| count_birth_order1/5 | -0.03409 | 0.08715 | -0.3912 | -0.2049 | 0.1367 | fixed |
| count_birth_order2/5 | 0.1125 | 0.09623 | 1.169 | -0.07613 | 0.3011 | fixed |
| count_birth_order3/5 | 0.05178 | 0.09796 | 0.5285 | -0.1402 | 0.2438 | fixed |
| count_birth_order4/5 | 0.03552 | 0.09973 | 0.3561 | -0.1599 | 0.231 | fixed |
| count_birth_order5/5 | 0.1267 | 0.1031 | 1.229 | -0.07539 | 0.3288 | fixed |
| count_birth_order1/5+ | -0.09157 | 0.06947 | -1.318 | -0.2277 | 0.04459 | fixed |
| count_birth_order2/5+ | -0.06085 | 0.07256 | -0.8386 | -0.2031 | 0.08136 | fixed |
| count_birth_order3/5+ | 0.0349 | 0.07161 | 0.4874 | -0.1055 | 0.1753 | fixed |
| count_birth_order4/5+ | 0.02553 | 0.06944 | 0.3677 | -0.1106 | 0.1616 | fixed |
| count_birth_order5/5+ | 0.06345 | 0.07022 | 0.9035 | -0.07419 | 0.2011 | fixed |
| count_birth_order5+/5+ | -0.002149 | 0.05532 | -0.03884 | -0.1106 | 0.1063 | fixed |
| sd_(Intercept).mother_pidlink | 0.2764 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9487 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 16856 | 16930 | -8417 | 16834 | NA | NA | NA |
| 12 | 16856 | 16936 | -8416 | 16832 | 2.37 | 1 | 0.1237 |
| 16 | 16861 | 16968 | -8415 | 16829 | 2.788 | 4 | 0.5939 |
| 26 | 16875 | 17049 | -8411 | 16823 | 6.743 | 10 | 0.7495 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.967 | 0.8516 | -3.484 | -4.636 | -1.298 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.24 | 0.09033 | 2.656 | 0.06292 | 0.417 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00612 | 0.003071 | -1.993 | -0.01214 | -0.0001006 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005134 | 0.00003351 | 1.532 | -0.00001433 | 0.000117 | fixed |
| male | 0.1734 | 0.03918 | 4.426 | 0.09659 | 0.2502 | fixed |
| sibling_count3 | 0.05539 | 0.06069 | 0.9127 | -0.06356 | 0.1743 | fixed |
| sibling_count4 | -0.05519 | 0.06241 | -0.8843 | -0.1775 | 0.06713 | fixed |
| sibling_count5 | -0.1223 | 0.07112 | -1.72 | -0.2617 | 0.01709 | fixed |
| sibling_count5+ | -0.1055 | 0.06141 | -1.718 | -0.2258 | 0.01488 | fixed |
| sd_(Intercept).mother_pidlink | 0.1431 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9554 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.949 | 0.851 | -3.465 | -4.617 | -1.281 | fixed |
| birth_order | 0.02897 | 0.01228 | 2.359 | 0.004905 | 0.05304 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2348 | 0.09028 | 2.601 | 0.05783 | 0.4117 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005999 | 0.003069 | -1.955 | -0.01201 | 0.00001559 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005109 | 0.00003348 | 1.526 | -0.00001453 | 0.0001167 | fixed |
| male | 0.1711 | 0.03915 | 4.371 | 0.09441 | 0.2479 | fixed |
| sibling_count3 | 0.04128 | 0.06096 | 0.6772 | -0.07819 | 0.1608 | fixed |
| sibling_count4 | -0.08726 | 0.06386 | -1.367 | -0.2124 | 0.03789 | fixed |
| sibling_count5 | -0.1757 | 0.07463 | -2.355 | -0.322 | -0.02945 | fixed |
| sibling_count5+ | -0.2097 | 0.07565 | -2.772 | -0.3579 | -0.0614 | fixed |
| sd_(Intercept).mother_pidlink | 0.1526 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9531 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.933 | 0.8519 | -3.443 | -4.603 | -1.264 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2365 | 0.09037 | 2.617 | 0.05938 | 0.4136 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006059 | 0.003072 | -1.972 | -0.01208 | -0.00003838 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000517 | 0.00003351 | 1.543 | -0.00001399 | 0.0001174 | fixed |
| male | 0.1724 | 0.03916 | 4.402 | 0.09565 | 0.2492 | fixed |
| sibling_count3 | 0.02577 | 0.06226 | 0.4139 | -0.09625 | 0.1478 | fixed |
| sibling_count4 | -0.1117 | 0.06659 | -1.678 | -0.2422 | 0.01879 | fixed |
| sibling_count5 | -0.1958 | 0.07894 | -2.48 | -0.3505 | -0.04107 | fixed |
| sibling_count5+ | -0.2197 | 0.07809 | -2.813 | -0.3727 | -0.06662 | fixed |
| birth_order_nonlinear2 | 0.02232 | 0.05137 | 0.4345 | -0.07837 | 0.123 | fixed |
| birth_order_nonlinear3 | 0.1267 | 0.06161 | 2.057 | 0.005969 | 0.2475 | fixed |
| birth_order_nonlinear4 | 0.1321 | 0.07471 | 1.769 | -0.01429 | 0.2786 | fixed |
| birth_order_nonlinear5 | 0.0958 | 0.09391 | 1.02 | -0.08827 | 0.2799 | fixed |
| birth_order_nonlinear5+ | 0.1847 | 0.09213 | 2.004 | 0.004083 | 0.3652 | fixed |
| sd_(Intercept).mother_pidlink | 0.1585 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9525 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.924 | 0.8537 | -3.424 | -4.597 | -1.25 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2359 | 0.09068 | 2.601 | 0.05814 | 0.4136 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006003 | 0.003083 | -1.947 | -0.01205 | 0.00003935 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005074 | 0.00003364 | 1.508 | -0.00001519 | 0.0001167 | fixed |
| male | 0.1682 | 0.03928 | 4.281 | 0.09118 | 0.2451 | fixed |
| count_birth_order2/2 | -0.01186 | 0.09694 | -0.1223 | -0.2019 | 0.1781 | fixed |
| count_birth_order1/3 | 0.002427 | 0.08014 | 0.03029 | -0.1546 | 0.1595 | fixed |
| count_birth_order2/3 | 0.08795 | 0.09083 | 0.9683 | -0.09007 | 0.266 | fixed |
| count_birth_order3/3 | 0.09969 | 0.1004 | 0.9929 | -0.09709 | 0.2965 | fixed |
| count_birth_order1/4 | -0.193 | 0.09389 | -2.056 | -0.3771 | -0.009012 | fixed |
| count_birth_order2/4 | -0.03204 | 0.09714 | -0.3299 | -0.2224 | 0.1584 | fixed |
| count_birth_order3/4 | 0.05193 | 0.1026 | 0.5059 | -0.1492 | 0.2531 | fixed |
| count_birth_order4/4 | -0.03512 | 0.11 | -0.3193 | -0.2507 | 0.1805 | fixed |
| count_birth_order1/5 | -0.0734 | 0.127 | -0.5779 | -0.3223 | 0.1755 | fixed |
| count_birth_order2/5 | -0.2006 | 0.1483 | -1.353 | -0.4913 | 0.09001 | fixed |
| count_birth_order3/5 | -0.1334 | 0.1329 | -1.003 | -0.3939 | 0.1272 | fixed |
| count_birth_order4/5 | -0.06657 | 0.1264 | -0.5265 | -0.3144 | 0.1812 | fixed |
| count_birth_order5/5 | -0.2006 | 0.1302 | -1.54 | -0.4559 | 0.05465 | fixed |
| count_birth_order1/5+ | -0.204 | 0.1252 | -1.629 | -0.4494 | 0.0414 | fixed |
| count_birth_order2/5+ | -0.4087 | 0.1263 | -3.236 | -0.6563 | -0.1611 | fixed |
| count_birth_order3/5+ | -0.06434 | 0.1266 | -0.5081 | -0.3125 | 0.1839 | fixed |
| count_birth_order4/5+ | -0.05434 | 0.1165 | -0.4663 | -0.2828 | 0.1741 | fixed |
| count_birth_order5/5+ | -0.07096 | 0.1149 | -0.6177 | -0.2961 | 0.1542 | fixed |
| count_birth_order5+/5+ | -0.04591 | 0.08527 | -0.5384 | -0.213 | 0.1212 | fixed |
| sd_(Intercept).mother_pidlink | 0.1652 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9515 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 7048 | 7112 | -3513 | 7026 | NA | NA | NA |
| 12 | 7045 | 7115 | -3510 | 7021 | 5.566 | 1 | 0.01831 |
| 16 | 7051 | 7144 | -3509 | 7019 | 1.971 | 4 | 0.741 |
| 26 | 7061 | 7213 | -3505 | 7009 | 9.311 | 10 | 0.5029 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.021 | 0.8508 | -3.551 | -4.689 | -1.354 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2478 | 0.09033 | 2.744 | 0.07078 | 0.4249 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006428 | 0.003071 | -2.093 | -0.01245 | -0.0004093 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005481 | 0.00003351 | 1.636 | -0.00001086 | 0.0001205 | fixed |
| male | 0.1666 | 0.03915 | 4.256 | 0.08989 | 0.2433 | fixed |
| sibling_count3 | 0.03445 | 0.06704 | 0.5139 | -0.09694 | 0.1658 | fixed |
| sibling_count4 | 0.00218 | 0.06772 | 0.03219 | -0.1305 | 0.1349 | fixed |
| sibling_count5 | -0.1056 | 0.0713 | -1.481 | -0.2454 | 0.03414 | fixed |
| sibling_count5+ | -0.08992 | 0.06331 | -1.42 | -0.214 | 0.03417 | fixed |
| sd_(Intercept).mother_pidlink | 0.1499 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9564 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.016 | 0.8506 | -3.546 | -4.683 | -1.349 | fixed |
| birth_order | 0.01776 | 0.01074 | 1.653 | -0.003294 | 0.03882 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2451 | 0.09032 | 2.714 | 0.06808 | 0.4221 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006365 | 0.00307 | -2.073 | -0.01238 | -0.0003467 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005472 | 0.0000335 | 1.633 | -0.00001094 | 0.0001204 | fixed |
| male | 0.1651 | 0.03914 | 4.218 | 0.08839 | 0.2418 | fixed |
| sibling_count3 | 0.0256 | 0.06726 | 0.3806 | -0.1062 | 0.1574 | fixed |
| sibling_count4 | -0.01668 | 0.06869 | -0.2428 | -0.1513 | 0.118 | fixed |
| sibling_count5 | -0.1356 | 0.07361 | -1.842 | -0.2799 | 0.00866 | fixed |
| sibling_count5+ | -0.1524 | 0.07377 | -2.066 | -0.297 | -0.007788 | fixed |
| sd_(Intercept).mother_pidlink | 0.1605 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9544 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.025 | 0.8511 | -3.555 | -4.693 | -1.357 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.247 | 0.09037 | 2.733 | 0.06989 | 0.4241 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006441 | 0.003072 | -2.097 | -0.01246 | -0.00042 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005564 | 0.00003352 | 1.66 | -0.00001005 | 0.0001213 | fixed |
| male | 0.1661 | 0.03914 | 4.244 | 0.08938 | 0.2428 | fixed |
| sibling_count3 | 0.005788 | 0.06854 | 0.08445 | -0.1285 | 0.1401 | fixed |
| sibling_count4 | -0.05279 | 0.07109 | -0.7426 | -0.1921 | 0.08654 | fixed |
| sibling_count5 | -0.167 | 0.07725 | -2.161 | -0.3184 | -0.01555 | fixed |
| sibling_count5+ | -0.1714 | 0.07608 | -2.254 | -0.3206 | -0.02234 | fixed |
| birth_order_nonlinear2 | 0.05834 | 0.0521 | 1.12 | -0.04379 | 0.1605 | fixed |
| birth_order_nonlinear3 | 0.1224 | 0.06201 | 1.974 | 0.0008591 | 0.2439 | fixed |
| birth_order_nonlinear4 | 0.1577 | 0.07258 | 2.173 | 0.01544 | 0.2999 | fixed |
| birth_order_nonlinear5 | 0.07475 | 0.08919 | 0.8381 | -0.1001 | 0.2496 | fixed |
| birth_order_nonlinear5+ | 0.1222 | 0.08292 | 1.473 | -0.04038 | 0.2847 | fixed |
| sd_(Intercept).mother_pidlink | 0.1634 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9539 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.005 | 0.8535 | -3.521 | -4.678 | -1.333 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2466 | 0.09072 | 2.718 | 0.06875 | 0.4244 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006401 | 0.003084 | -2.075 | -0.01245 | -0.0003561 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005498 | 0.00003365 | 1.634 | -0.00001098 | 0.0001209 | fixed |
| male | 0.1643 | 0.03928 | 4.183 | 0.08731 | 0.2413 | fixed |
| count_birth_order2/2 | -0.01229 | 0.1097 | -0.112 | -0.2272 | 0.2027 | fixed |
| count_birth_order1/3 | -0.03131 | 0.08855 | -0.3535 | -0.2049 | 0.1422 | fixed |
| count_birth_order2/3 | 0.1016 | 0.09821 | 1.035 | -0.09088 | 0.2941 | fixed |
| count_birth_order3/3 | 0.054 | 0.1103 | 0.4897 | -0.1621 | 0.2702 | fixed |
| count_birth_order1/4 | -0.1062 | 0.09942 | -1.068 | -0.301 | 0.0887 | fixed |
| count_birth_order2/4 | 0.06707 | 0.1002 | 0.6692 | -0.1294 | 0.2635 | fixed |
| count_birth_order3/4 | 0.02235 | 0.1126 | 0.1984 | -0.1984 | 0.2431 | fixed |
| count_birth_order4/4 | 0.02293 | 0.1206 | 0.19 | -0.2135 | 0.2594 | fixed |
| count_birth_order1/5 | -0.1291 | 0.116 | -1.113 | -0.3564 | 0.09827 | fixed |
| count_birth_order2/5 | -0.1532 | 0.1278 | -1.199 | -0.4036 | 0.09726 | fixed |
| count_birth_order3/5 | -0.05305 | 0.1277 | -0.4155 | -0.3033 | 0.1972 | fixed |
| count_birth_order4/5 | -0.03084 | 0.1287 | -0.2395 | -0.2832 | 0.2215 | fixed |
| count_birth_order5/5 | -0.1853 | 0.1282 | -1.446 | -0.4366 | 0.06595 | fixed |
| count_birth_order1/5+ | -0.2191 | 0.1105 | -1.984 | -0.4356 | -0.002651 | fixed |
| count_birth_order2/5+ | -0.2885 | 0.1175 | -2.456 | -0.5188 | -0.05829 | fixed |
| count_birth_order3/5+ | 0.006948 | 0.1182 | 0.05879 | -0.2247 | 0.2386 | fixed |
| count_birth_order4/5+ | 0.008072 | 0.1093 | 0.07383 | -0.2062 | 0.2223 | fixed |
| count_birth_order5/5+ | -0.06426 | 0.1169 | -0.5495 | -0.2935 | 0.165 | fixed |
| count_birth_order5+/5+ | -0.07115 | 0.08545 | -0.8326 | -0.2386 | 0.09633 | fixed |
| sd_(Intercept).mother_pidlink | 0.1732 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9527 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 7103 | 7167 | -3541 | 7081 | NA | NA | NA |
| 12 | 7102 | 7173 | -3539 | 7078 | 2.723 | 1 | 0.0989 |
| 16 | 7106 | 7200 | -3537 | 7074 | 3.99 | 4 | 0.4074 |
| 26 | 7119 | 7271 | -3533 | 7067 | 7.706 | 10 | 0.6575 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.95 | 0.8647 | -3.411 | -4.644 | -1.255 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2362 | 0.09172 | 2.575 | 0.05644 | 0.416 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005959 | 0.003116 | -1.912 | -0.01207 | 0.000149 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004927 | 0.00003398 | 1.45 | -0.00001733 | 0.0001159 | fixed |
| male | 0.1752 | 0.03992 | 4.388 | 0.09692 | 0.2534 | fixed |
| sibling_count3 | 0.04336 | 0.06038 | 0.7181 | -0.07499 | 0.1617 | fixed |
| sibling_count4 | -0.08107 | 0.06277 | -1.292 | -0.2041 | 0.04196 | fixed |
| sibling_count5 | -0.09708 | 0.07355 | -1.32 | -0.2412 | 0.04707 | fixed |
| sibling_count5+ | -0.08266 | 0.06241 | -1.324 | -0.205 | 0.03966 | fixed |
| sd_(Intercept).mother_pidlink | 0.15 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9632 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.931 | 0.8643 | -3.391 | -4.625 | -1.237 | fixed |
| birth_order | 0.02467 | 0.01273 | 1.938 | -0.0002824 | 0.04963 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2313 | 0.09171 | 2.523 | 0.0516 | 0.4111 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005839 | 0.003115 | -1.874 | -0.01195 | 0.0002667 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00004885 | 0.00003396 | 1.438 | -0.00001772 | 0.0001154 | fixed |
| male | 0.1739 | 0.03991 | 4.357 | 0.09568 | 0.2521 | fixed |
| sibling_count3 | 0.03093 | 0.06071 | 0.5095 | -0.08806 | 0.1499 | fixed |
| sibling_count4 | -0.108 | 0.06429 | -1.68 | -0.234 | 0.01797 | fixed |
| sibling_count5 | -0.1412 | 0.07701 | -1.834 | -0.2921 | 0.009731 | fixed |
| sibling_count5+ | -0.1711 | 0.07736 | -2.212 | -0.3228 | -0.01952 | fixed |
| sd_(Intercept).mother_pidlink | 0.1571 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9616 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.945 | 0.8651 | -3.404 | -4.641 | -1.25 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2361 | 0.09179 | 2.573 | 0.05623 | 0.416 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006009 | 0.003118 | -1.927 | -0.01212 | 0.0001024 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000507 | 0.000034 | 1.491 | -0.00001593 | 0.0001173 | fixed |
| male | 0.1757 | 0.03993 | 4.402 | 0.09749 | 0.254 | fixed |
| sibling_count3 | 0.009872 | 0.06207 | 0.159 | -0.1118 | 0.1315 | fixed |
| sibling_count4 | -0.1259 | 0.06698 | -1.88 | -0.2572 | 0.005376 | fixed |
| sibling_count5 | -0.1521 | 0.08111 | -1.875 | -0.3111 | 0.006863 | fixed |
| sibling_count5+ | -0.1838 | 0.07992 | -2.3 | -0.3404 | -0.02714 | fixed |
| birth_order_nonlinear2 | 0.01217 | 0.05179 | 0.235 | -0.08934 | 0.1137 | fixed |
| birth_order_nonlinear3 | 0.1384 | 0.0622 | 2.225 | 0.01651 | 0.2603 | fixed |
| birth_order_nonlinear4 | 0.05726 | 0.07794 | 0.7346 | -0.0955 | 0.21 | fixed |
| birth_order_nonlinear5 | 0.07804 | 0.09835 | 0.7935 | -0.1147 | 0.2708 | fixed |
| birth_order_nonlinear5+ | 0.1773 | 0.09559 | 1.855 | -0.01002 | 0.3647 | fixed |
| sd_(Intercept).mother_pidlink | 0.1621 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9608 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.969 | 0.8669 | -3.426 | -4.668 | -1.27 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2408 | 0.09211 | 2.615 | 0.06029 | 0.4214 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.006135 | 0.003129 | -1.96 | -0.01227 | -0.000001385 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005172 | 0.00003412 | 1.516 | -0.00001516 | 0.0001186 | fixed |
| male | 0.1726 | 0.04006 | 4.308 | 0.09407 | 0.2511 | fixed |
| count_birth_order2/2 | -0.07046 | 0.09561 | -0.7369 | -0.2579 | 0.1169 | fixed |
| count_birth_order1/3 | -0.04347 | 0.08004 | -0.5431 | -0.2003 | 0.1134 | fixed |
| count_birth_order2/3 | 0.06615 | 0.09109 | 0.7262 | -0.1124 | 0.2447 | fixed |
| count_birth_order3/3 | 0.08534 | 0.09871 | 0.8646 | -0.1081 | 0.2788 | fixed |
| count_birth_order1/4 | -0.2178 | 0.09523 | -2.287 | -0.4044 | -0.03112 | fixed |
| count_birth_order2/4 | -0.0797 | 0.09775 | -0.8153 | -0.2713 | 0.1119 | fixed |
| count_birth_order3/4 | 0.04818 | 0.1035 | 0.4657 | -0.1546 | 0.251 | fixed |
| count_birth_order4/4 | -0.1601 | 0.1133 | -1.414 | -0.3821 | 0.06185 | fixed |
| count_birth_order1/5 | -0.08318 | 0.1309 | -0.6352 | -0.3398 | 0.1735 | fixed |
| count_birth_order2/5 | -0.1651 | 0.1522 | -1.085 | -0.4634 | 0.1332 | fixed |
| count_birth_order3/5 | -0.09123 | 0.1405 | -0.6492 | -0.3667 | 0.1842 | fixed |
| count_birth_order4/5 | -0.1192 | 0.1345 | -0.8861 | -0.3827 | 0.1444 | fixed |
| count_birth_order5/5 | -0.1676 | 0.1392 | -1.204 | -0.4405 | 0.1053 | fixed |
| count_birth_order1/5+ | -0.1719 | 0.1281 | -1.342 | -0.4229 | 0.07922 | fixed |
| count_birth_order2/5+ | -0.3917 | 0.1323 | -2.961 | -0.6509 | -0.1324 | fixed |
| count_birth_order3/5+ | -0.06893 | 0.1285 | -0.5364 | -0.3208 | 0.1829 | fixed |
| count_birth_order4/5+ | -0.07846 | 0.1223 | -0.6416 | -0.3181 | 0.1612 | fixed |
| count_birth_order5/5+ | -0.08894 | 0.1182 | -0.7525 | -0.3206 | 0.1427 | fixed |
| count_birth_order5+/5+ | -0.03323 | 0.08726 | -0.3809 | -0.2042 | 0.1378 | fixed |
| sd_(Intercept).mother_pidlink | 0.1651 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9606 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 6958 | 7022 | -3468 | 6936 | NA | NA | NA |
| 12 | 6956 | 7026 | -3466 | 6932 | 3.756 | 1 | 0.05262 |
| 16 | 6960 | 7053 | -3464 | 6928 | 3.587 | 4 | 0.4648 |
| 26 | 6971 | 7123 | -3460 | 6919 | 8.955 | 10 | 0.5364 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = wage_last_year_z)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.932 | 0.3808 | -10.33 | -4.679 | -3.186 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.3021 | 0.03594 | 8.408 | 0.2317 | 0.3726 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.007364 | 0.001071 | -6.873 | -0.009464 | -0.005264 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005769 | 0.00001015 | 5.683 | 0.00003779 | 0.00007758 | fixed |
| male | 0.1267 | 0.02642 | 4.798 | 0.07497 | 0.1785 | fixed |
| sibling_count3 | 0.0766 | 0.05286 | 1.449 | -0.02701 | 0.1802 | fixed |
| sibling_count4 | 0.04296 | 0.05286 | 0.8128 | -0.06064 | 0.1466 | fixed |
| sibling_count5 | 0.03471 | 0.05503 | 0.6307 | -0.07315 | 0.1426 | fixed |
| sibling_count5+ | -0.04989 | 0.04336 | -1.151 | -0.1349 | 0.03509 | fixed |
| sd_(Intercept).mother_pidlink | 0.341 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9299 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.925 | 0.3809 | -10.3 | -4.672 | -3.179 | fixed |
| birth_order | 0.003522 | 0.005228 | 0.6737 | -0.006725 | 0.01377 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.3005 | 0.03602 | 8.344 | 0.2299 | 0.3711 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.007309 | 0.001075 | -6.801 | -0.009415 | -0.005202 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005716 | 0.00001018 | 5.614 | 0.00003721 | 0.00007712 | fixed |
| male | 0.1265 | 0.02642 | 4.789 | 0.07475 | 0.1783 | fixed |
| sibling_count3 | 0.07559 | 0.05289 | 1.429 | -0.02807 | 0.1793 | fixed |
| sibling_count4 | 0.0403 | 0.05301 | 0.7601 | -0.06361 | 0.1442 | fixed |
| sibling_count5 | 0.03033 | 0.05542 | 0.5472 | -0.07829 | 0.139 | fixed |
| sibling_count5+ | -0.06306 | 0.04756 | -1.326 | -0.1563 | 0.03016 | fixed |
| sd_(Intercept).mother_pidlink | 0.3417 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9298 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.911 | 0.3816 | -10.25 | -4.659 | -3.163 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.3 | 0.03603 | 8.327 | 0.2294 | 0.3707 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.007284 | 0.001075 | -6.773 | -0.009392 | -0.005176 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005682 | 0.0000102 | 5.573 | 0.00003684 | 0.0000768 | fixed |
| male | 0.1269 | 0.02642 | 4.801 | 0.07508 | 0.1787 | fixed |
| sibling_count3 | 0.08191 | 0.05362 | 1.528 | -0.02318 | 0.187 | fixed |
| sibling_count4 | 0.04998 | 0.05468 | 0.9141 | -0.05719 | 0.1572 | fixed |
| sibling_count5 | 0.02631 | 0.05763 | 0.4565 | -0.08664 | 0.1393 | fixed |
| sibling_count5+ | -0.06185 | 0.05001 | -1.237 | -0.1599 | 0.03617 | fixed |
| birth_order_nonlinear2 | -0.0194 | 0.03805 | -0.5098 | -0.09398 | 0.05518 | fixed |
| birth_order_nonlinear3 | -0.0268 | 0.04408 | -0.608 | -0.1132 | 0.0596 | fixed |
| birth_order_nonlinear4 | -0.01244 | 0.04932 | -0.2522 | -0.1091 | 0.08423 | fixed |
| birth_order_nonlinear5 | 0.07847 | 0.05601 | 1.401 | -0.03131 | 0.1883 | fixed |
| birth_order_nonlinear5+ | 0.006064 | 0.04625 | 0.1311 | -0.08458 | 0.09671 | fixed |
| sd_(Intercept).mother_pidlink | 0.3407 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9302 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -3.899 | 0.3829 | -10.18 | -4.649 | -3.148 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2982 | 0.03608 | 8.265 | 0.2275 | 0.3689 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.007207 | 0.001077 | -6.691 | -0.009319 | -0.005096 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005593 | 0.00001021 | 5.476 | 0.00003591 | 0.00007595 | fixed |
| male | 0.1262 | 0.02645 | 4.771 | 0.07434 | 0.178 | fixed |
| count_birth_order2/2 | -0.02015 | 0.07713 | -0.2613 | -0.1713 | 0.131 | fixed |
| count_birth_order1/3 | 0.09485 | 0.06972 | 1.36 | -0.04181 | 0.2315 | fixed |
| count_birth_order2/3 | 0.03908 | 0.0799 | 0.4891 | -0.1175 | 0.1957 | fixed |
| count_birth_order3/3 | 0.05765 | 0.08899 | 0.6479 | -0.1168 | 0.2321 | fixed |
| count_birth_order1/4 | 0.1217 | 0.07784 | 1.563 | -0.03087 | 0.2743 | fixed |
| count_birth_order2/4 | 0.02243 | 0.08287 | 0.2707 | -0.14 | 0.1849 | fixed |
| count_birth_order3/4 | -0.07628 | 0.08696 | -0.8772 | -0.2467 | 0.09416 | fixed |
| count_birth_order4/4 | 0.04495 | 0.09473 | 0.4745 | -0.1407 | 0.2306 | fixed |
| count_birth_order1/5 | 0.07361 | 0.08756 | 0.8407 | -0.09801 | 0.2452 | fixed |
| count_birth_order2/5 | 0.0388 | 0.09613 | 0.4036 | -0.1496 | 0.2272 | fixed |
| count_birth_order3/5 | 0.03883 | 0.09843 | 0.3945 | -0.1541 | 0.2318 | fixed |
| count_birth_order4/5 | -0.1091 | 0.1005 | -1.086 | -0.3061 | 0.08788 | fixed |
| count_birth_order5/5 | 0.07412 | 0.1036 | 0.7154 | -0.129 | 0.2772 | fixed |
| count_birth_order1/5+ | -0.1477 | 0.06989 | -2.113 | -0.2846 | -0.01067 | fixed |
| count_birth_order2/5+ | -0.07679 | 0.07276 | -1.055 | -0.2194 | 0.06581 | fixed |
| count_birth_order3/5+ | -0.05401 | 0.072 | -0.7501 | -0.1951 | 0.08711 | fixed |
| count_birth_order4/5+ | -0.0383 | 0.0698 | -0.5487 | -0.1751 | 0.09851 | fixed |
| count_birth_order5/5+ | 0.02497 | 0.07063 | 0.3535 | -0.1135 | 0.1634 | fixed |
| count_birth_order5+/5+ | -0.05612 | 0.05586 | -1.005 | -0.1656 | 0.05337 | fixed |
| sd_(Intercept).mother_pidlink | 0.3415 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9299 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 16736 | 16809 | -8357 | 16714 | NA | NA | NA |
| 12 | 16737 | 16818 | -8357 | 16713 | 0.4529 | 1 | 0.501 |
| 16 | 16742 | 16849 | -8355 | 16710 | 3.397 | 4 | 0.4938 |
| 26 | 16752 | 16926 | -8350 | 16700 | 10.14 | 10 | 0.4285 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.457 | 0.8887 | -6.141 | -7.199 | -3.715 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4617 | 0.0944 | 4.891 | 0.2767 | 0.6468 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01258 | 0.003215 | -3.911 | -0.01888 | -0.006274 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0001155 | 0.00003516 | 3.286 | 0.00004662 | 0.0001845 | fixed |
| male | 0.17 | 0.04053 | 4.196 | 0.0906 | 0.2495 | fixed |
| sibling_count3 | 0.03386 | 0.06327 | 0.5352 | -0.09015 | 0.1579 | fixed |
| sibling_count4 | -0.04681 | 0.06518 | -0.7182 | -0.1745 | 0.08093 | fixed |
| sibling_count5 | -0.1543 | 0.07425 | -2.078 | -0.2998 | -0.008749 | fixed |
| sibling_count5+ | -0.1823 | 0.0642 | -2.84 | -0.3081 | -0.05649 | fixed |
| sd_(Intercept).mother_pidlink | 0.2543 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9641 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.45 | 0.8887 | -6.133 | -7.192 | -3.709 | fixed |
| birth_order | 0.01116 | 0.01275 | 0.8758 | -0.01382 | 0.03615 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4598 | 0.09444 | 4.869 | 0.2747 | 0.6449 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01253 | 0.003216 | -3.897 | -0.01884 | -0.006228 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0001155 | 0.00003516 | 3.284 | 0.00004655 | 0.0001844 | fixed |
| male | 0.1691 | 0.04054 | 4.171 | 0.08963 | 0.2485 | fixed |
| sibling_count3 | 0.02843 | 0.06359 | 0.4472 | -0.0962 | 0.1531 | fixed |
| sibling_count4 | -0.05926 | 0.06673 | -0.8881 | -0.19 | 0.07152 | fixed |
| sibling_count5 | -0.175 | 0.07795 | -2.245 | -0.3278 | -0.02224 | fixed |
| sibling_count5+ | -0.2227 | 0.07907 | -2.817 | -0.3777 | -0.06775 | fixed |
| sd_(Intercept).mother_pidlink | 0.2562 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9637 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.411 | 0.8892 | -6.085 | -7.154 | -3.668 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4567 | 0.09448 | 4.833 | 0.2715 | 0.6418 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01242 | 0.003218 | -3.861 | -0.01873 | -0.006117 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0001143 | 0.00003518 | 3.248 | 0.0000453 | 0.0001832 | fixed |
| male | 0.1692 | 0.04053 | 4.174 | 0.08973 | 0.2486 | fixed |
| sibling_count3 | 0.01621 | 0.06489 | 0.2498 | -0.111 | 0.1434 | fixed |
| sibling_count4 | -0.08453 | 0.06948 | -1.216 | -0.2207 | 0.05166 | fixed |
| sibling_count5 | -0.1747 | 0.08228 | -2.123 | -0.336 | -0.01344 | fixed |
| sibling_count5+ | -0.2263 | 0.08151 | -2.777 | -0.3861 | -0.06659 | fixed |
| birth_order_nonlinear2 | 0.01137 | 0.05292 | 0.2149 | -0.09235 | 0.1151 | fixed |
| birth_order_nonlinear3 | 0.07625 | 0.06357 | 1.199 | -0.04834 | 0.2008 | fixed |
| birth_order_nonlinear4 | 0.101 | 0.07699 | 1.311 | -0.04993 | 0.2519 | fixed |
| birth_order_nonlinear5 | -0.07953 | 0.09654 | -0.8238 | -0.2687 | 0.1097 | fixed |
| birth_order_nonlinear5+ | 0.09209 | 0.09551 | 0.9642 | -0.09511 | 0.2793 | fixed |
| sd_(Intercept).mother_pidlink | 0.262 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.962 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.375 | 0.8908 | -6.033 | -7.121 | -3.629 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4507 | 0.09477 | 4.756 | 0.265 | 0.6365 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01218 | 0.003228 | -3.774 | -0.01851 | -0.005857 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0001113 | 0.0000353 | 3.153 | 0.00004211 | 0.0001805 | fixed |
| male | 0.1628 | 0.04062 | 4.007 | 0.08315 | 0.2424 | fixed |
| count_birth_order2/2 | 0.05057 | 0.0999 | 0.5062 | -0.1452 | 0.2464 | fixed |
| count_birth_order1/3 | 0.008136 | 0.08297 | 0.09806 | -0.1545 | 0.1708 | fixed |
| count_birth_order2/3 | 0.11 | 0.09415 | 1.168 | -0.07454 | 0.2945 | fixed |
| count_birth_order3/3 | 0.05356 | 0.1036 | 0.5168 | -0.1496 | 0.2567 | fixed |
| count_birth_order1/4 | -0.09397 | 0.09738 | -0.965 | -0.2848 | 0.09689 | fixed |
| count_birth_order2/4 | -0.06464 | 0.1005 | -0.6428 | -0.2617 | 0.1324 | fixed |
| count_birth_order3/4 | 0.04913 | 0.1063 | 0.4623 | -0.1592 | 0.2574 | fixed |
| count_birth_order4/4 | 0.0121 | 0.1135 | 0.1066 | -0.2104 | 0.2346 | fixed |
| count_birth_order1/5 | -0.008234 | 0.1311 | -0.06281 | -0.2652 | 0.2487 | fixed |
| count_birth_order2/5 | -0.1178 | 0.153 | -0.7701 | -0.4177 | 0.182 | fixed |
| count_birth_order3/5 | -0.1788 | 0.1381 | -1.295 | -0.4495 | 0.09185 | fixed |
| count_birth_order4/5 | -0.04439 | 0.1305 | -0.3402 | -0.3001 | 0.2113 | fixed |
| count_birth_order5/5 | -0.3668 | 0.1344 | -2.729 | -0.6302 | -0.1033 | fixed |
| count_birth_order1/5+ | -0.1898 | 0.1294 | -1.467 | -0.4434 | 0.06372 | fixed |
| count_birth_order2/5+ | -0.4359 | 0.1304 | -3.343 | -0.6915 | -0.1804 | fixed |
| count_birth_order3/5+ | -0.0447 | 0.1321 | -0.3384 | -0.3036 | 0.2142 | fixed |
| count_birth_order4/5+ | -0.1088 | 0.1208 | -0.9012 | -0.3455 | 0.1279 | fixed |
| count_birth_order5/5+ | -0.2063 | 0.1181 | -1.747 | -0.4377 | 0.0251 | fixed |
| count_birth_order5+/5+ | -0.122 | 0.0885 | -1.378 | -0.2954 | 0.05147 | fixed |
| sd_(Intercept).mother_pidlink | 0.2591 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9626 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 7164 | 7228 | -3571 | 7142 | NA | NA | NA |
| 12 | 7165 | 7235 | -3570 | 7141 | 0.7669 | 1 | 0.3812 |
| 16 | 7168 | 7261 | -3568 | 7136 | 4.699 | 4 | 0.3195 |
| 26 | 7177 | 7329 | -3563 | 7125 | 10.95 | 10 | 0.3616 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.441 | 0.8839 | -6.156 | -7.173 | -3.708 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4605 | 0.09398 | 4.9 | 0.2763 | 0.6447 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01255 | 0.003201 | -3.921 | -0.01883 | -0.006279 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0001153 | 0.00003501 | 3.292 | 0.00004664 | 0.0001839 | fixed |
| male | 0.1649 | 0.04032 | 4.089 | 0.08584 | 0.2439 | fixed |
| sibling_count3 | 0.03006 | 0.06953 | 0.4324 | -0.1062 | 0.1663 | fixed |
| sibling_count4 | 0.01484 | 0.07034 | 0.2109 | -0.123 | 0.1527 | fixed |
| sibling_count5 | -0.1237 | 0.07397 | -1.673 | -0.2687 | 0.02123 | fixed |
| sibling_count5+ | -0.153 | 0.06571 | -2.328 | -0.2817 | -0.02416 | fixed |
| sd_(Intercept).mother_pidlink | 0.2542 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.962 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.441 | 0.884 | -6.154 | -7.173 | -3.708 | fixed |
| birth_order | 0.001754 | 0.01111 | 0.158 | -0.02002 | 0.02352 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4603 | 0.09402 | 4.896 | 0.276 | 0.6446 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01255 | 0.003202 | -3.919 | -0.01882 | -0.006272 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0001153 | 0.00003501 | 3.292 | 0.00004663 | 0.0001839 | fixed |
| male | 0.1647 | 0.04034 | 4.083 | 0.08564 | 0.2438 | fixed |
| sibling_count3 | 0.02918 | 0.06976 | 0.4183 | -0.1076 | 0.1659 | fixed |
| sibling_count4 | 0.01296 | 0.07136 | 0.1816 | -0.1269 | 0.1528 | fixed |
| sibling_count5 | -0.1267 | 0.07636 | -1.66 | -0.2764 | 0.02293 | fixed |
| sibling_count5+ | -0.1591 | 0.07655 | -2.079 | -0.3092 | -0.00911 | fixed |
| sd_(Intercept).mother_pidlink | 0.2551 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9619 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.442 | 0.8838 | -6.157 | -7.174 | -3.71 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4599 | 0.09399 | 4.893 | 0.2757 | 0.6442 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01254 | 0.003201 | -3.916 | -0.01881 | -0.006262 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0001151 | 0.000035 | 3.289 | 0.00004653 | 0.0001837 | fixed |
| male | 0.1643 | 0.0403 | 4.077 | 0.08532 | 0.2433 | fixed |
| sibling_count3 | 0.009383 | 0.07102 | 0.1321 | -0.1298 | 0.1486 | fixed |
| sibling_count4 | -0.0289 | 0.07374 | -0.3919 | -0.1734 | 0.1156 | fixed |
| sibling_count5 | -0.1455 | 0.07999 | -1.819 | -0.3023 | 0.01128 | fixed |
| sibling_count5+ | -0.1811 | 0.07882 | -2.297 | -0.3356 | -0.0266 | fixed |
| birth_order_nonlinear2 | 0.02068 | 0.05343 | 0.3871 | -0.08405 | 0.1254 | fixed |
| birth_order_nonlinear3 | 0.09024 | 0.06368 | 1.417 | -0.03457 | 0.215 | fixed |
| birth_order_nonlinear4 | 0.1398 | 0.07445 | 1.878 | -0.00608 | 0.2858 | fixed |
| birth_order_nonlinear5 | -0.1024 | 0.0914 | -1.121 | -0.2816 | 0.07671 | fixed |
| birth_order_nonlinear5+ | 0.03478 | 0.08567 | 0.406 | -0.1331 | 0.2027 | fixed |
| sd_(Intercept).mother_pidlink | 0.2586 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9602 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.453 | 0.8868 | -6.149 | -7.191 | -3.715 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4599 | 0.09439 | 4.873 | 0.2749 | 0.6449 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01251 | 0.003215 | -3.89 | -0.01881 | -0.006206 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0001146 | 0.00003516 | 3.259 | 0.00004568 | 0.0001835 | fixed |
| male | 0.1614 | 0.04046 | 3.989 | 0.08207 | 0.2407 | fixed |
| count_birth_order2/2 | 0.03684 | 0.1127 | 0.327 | -0.184 | 0.2577 | fixed |
| count_birth_order1/3 | -0.01654 | 0.09127 | -0.1812 | -0.1954 | 0.1624 | fixed |
| count_birth_order2/3 | 0.1026 | 0.1014 | 1.012 | -0.09611 | 0.3012 | fixed |
| count_birth_order3/3 | 0.07168 | 0.1133 | 0.6325 | -0.1505 | 0.2938 | fixed |
| count_birth_order1/4 | 0.000209 | 0.1026 | 0.002036 | -0.2009 | 0.2014 | fixed |
| count_birth_order2/4 | 0.01402 | 0.1032 | 0.1358 | -0.1883 | 0.2164 | fixed |
| count_birth_order3/4 | 0.02956 | 0.1166 | 0.2536 | -0.1989 | 0.258 | fixed |
| count_birth_order4/4 | 0.08172 | 0.124 | 0.6593 | -0.1612 | 0.3247 | fixed |
| count_birth_order1/5 | -0.07394 | 0.1193 | -0.6201 | -0.3077 | 0.1598 | fixed |
| count_birth_order2/5 | -0.1639 | 0.1313 | -1.249 | -0.4212 | 0.09335 | fixed |
| count_birth_order3/5 | -0.01559 | 0.1312 | -0.1188 | -0.2727 | 0.2415 | fixed |
| count_birth_order4/5 | 0.03078 | 0.1323 | 0.2328 | -0.2284 | 0.29 | fixed |
| count_birth_order5/5 | -0.3571 | 0.1317 | -2.712 | -0.6153 | -0.09899 | fixed |
| count_birth_order1/5+ | -0.1954 | 0.1136 | -1.72 | -0.4181 | 0.02726 | fixed |
| count_birth_order2/5+ | -0.2732 | 0.1208 | -2.263 | -0.5099 | -0.03654 | fixed |
| count_birth_order3/5+ | -0.03812 | 0.122 | -0.3126 | -0.2772 | 0.2009 | fixed |
| count_birth_order4/5+ | -0.03309 | 0.1126 | -0.2937 | -0.2539 | 0.1877 | fixed |
| count_birth_order5/5+ | -0.1922 | 0.1201 | -1.6 | -0.4277 | 0.04322 | fixed |
| count_birth_order5+/5+ | -0.1421 | 0.08825 | -1.61 | -0.3151 | 0.03088 | fixed |
| sd_(Intercept).mother_pidlink | 0.2591 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9609 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 7198 | 7262 | -3588 | 7176 | NA | NA | NA |
| 12 | 7200 | 7270 | -3588 | 7176 | 0.02429 | 1 | 0.8761 |
| 16 | 7200 | 7293 | -3584 | 7168 | 8.315 | 4 | 0.08069 |
| 26 | 7214 | 7366 | -3581 | 7162 | 5.651 | 10 | 0.8437 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.422 | 0.9015 | -6.014 | -7.188 | -3.655 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4572 | 0.09577 | 4.773 | 0.2694 | 0.6449 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01237 | 0.00326 | -3.794 | -0.01876 | -0.005979 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0001128 | 0.00003563 | 3.166 | 0.00004296 | 0.0001826 | fixed |
| male | 0.1739 | 0.04126 | 4.215 | 0.09305 | 0.2548 | fixed |
| sibling_count3 | -0.003189 | 0.06289 | -0.05071 | -0.1264 | 0.1201 | fixed |
| sibling_count4 | -0.1003 | 0.06552 | -1.53 | -0.2287 | 0.02815 | fixed |
| sibling_count5 | -0.1661 | 0.07676 | -2.164 | -0.3166 | -0.01569 | fixed |
| sibling_count5+ | -0.1681 | 0.06519 | -2.579 | -0.2959 | -0.04036 | fixed |
| sd_(Intercept).mother_pidlink | 0.2569 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.972 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.415 | 0.9017 | -6.005 | -7.182 | -3.648 | fixed |
| birth_order | 0.008665 | 0.0132 | 0.6563 | -0.01721 | 0.03455 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4554 | 0.09582 | 4.753 | 0.2676 | 0.6432 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01233 | 0.003261 | -3.78 | -0.01872 | -0.005935 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0001127 | 0.00003563 | 3.161 | 0.00004281 | 0.0001825 | fixed |
| male | 0.1734 | 0.04128 | 4.2 | 0.09248 | 0.2543 | fixed |
| sibling_count3 | -0.007568 | 0.06326 | -0.1196 | -0.1315 | 0.1164 | fixed |
| sibling_count4 | -0.1098 | 0.06712 | -1.635 | -0.2413 | 0.02178 | fixed |
| sibling_count5 | -0.1818 | 0.08039 | -2.261 | -0.3393 | -0.0242 | fixed |
| sibling_count5+ | -0.1994 | 0.08076 | -2.469 | -0.3577 | -0.0411 | fixed |
| sd_(Intercept).mother_pidlink | 0.2582 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9718 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.41 | 0.9024 | -5.996 | -7.179 | -3.642 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4563 | 0.09589 | 4.759 | 0.2684 | 0.6443 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01236 | 0.003263 | -3.788 | -0.01876 | -0.005966 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0001131 | 0.00003566 | 3.171 | 0.00004319 | 0.000183 | fixed |
| male | 0.174 | 0.04128 | 4.214 | 0.09307 | 0.2549 | fixed |
| sibling_count3 | -0.02677 | 0.06466 | -0.4139 | -0.1535 | 0.09997 | fixed |
| sibling_count4 | -0.1287 | 0.06985 | -1.842 | -0.2656 | 0.008219 | fixed |
| sibling_count5 | -0.1758 | 0.08455 | -2.079 | -0.3415 | -0.01005 | fixed |
| sibling_count5+ | -0.2091 | 0.08338 | -2.508 | -0.3726 | -0.04571 | fixed |
| birth_order_nonlinear2 | -0.0007985 | 0.0533 | -0.01498 | -0.1053 | 0.1037 | fixed |
| birth_order_nonlinear3 | 0.09794 | 0.06412 | 1.528 | -0.02772 | 0.2236 | fixed |
| birth_order_nonlinear4 | 0.0248 | 0.08029 | 0.3089 | -0.1326 | 0.1822 | fixed |
| birth_order_nonlinear5 | -0.07846 | 0.1009 | -0.7773 | -0.2763 | 0.1194 | fixed |
| birth_order_nonlinear5+ | 0.1007 | 0.09905 | 1.016 | -0.09349 | 0.2948 | fixed |
| sd_(Intercept).mother_pidlink | 0.2667 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9694 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -5.398 | 0.9042 | -5.97 | -7.171 | -3.626 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.4538 | 0.09623 | 4.715 | 0.2652 | 0.6424 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.01223 | 0.003276 | -3.734 | -0.01865 | -0.005812 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0001112 | 0.0000358 | 3.106 | 0.00004103 | 0.0001814 | fixed |
| male | 0.1673 | 0.04143 | 4.04 | 0.08615 | 0.2485 | fixed |
| count_birth_order2/2 | 0.01444 | 0.09844 | 0.1467 | -0.1785 | 0.2074 | fixed |
| count_birth_order1/3 | -0.06221 | 0.08283 | -0.751 | -0.2246 | 0.1001 | fixed |
| count_birth_order2/3 | 0.07763 | 0.09437 | 0.8226 | -0.1073 | 0.2626 | fixed |
| count_birth_order3/3 | 0.03025 | 0.1018 | 0.297 | -0.1694 | 0.2299 | fixed |
| count_birth_order1/4 | -0.1345 | 0.09873 | -1.362 | -0.328 | 0.05905 | fixed |
| count_birth_order2/4 | -0.1646 | 0.1011 | -1.628 | -0.3628 | 0.0336 | fixed |
| count_birth_order3/4 | 0.02741 | 0.1071 | 0.2559 | -0.1825 | 0.2373 | fixed |
| count_birth_order4/4 | -0.08879 | 0.1173 | -0.757 | -0.3187 | 0.1411 | fixed |
| count_birth_order1/5 | -0.002286 | 0.1351 | -0.01692 | -0.2671 | 0.2626 | fixed |
| count_birth_order2/5 | -0.1884 | 0.157 | -1.2 | -0.4961 | 0.1192 | fixed |
| count_birth_order3/5 | -0.1273 | 0.146 | -0.8719 | -0.4136 | 0.1589 | fixed |
| count_birth_order4/5 | -0.2074 | 0.1387 | -1.496 | -0.4792 | 0.0644 | fixed |
| count_birth_order5/5 | -0.3175 | 0.1436 | -2.211 | -0.5989 | -0.03604 | fixed |
| count_birth_order1/5+ | -0.1604 | 0.1323 | -1.212 | -0.4196 | 0.09893 | fixed |
| count_birth_order2/5+ | -0.3924 | 0.1365 | -2.875 | -0.66 | -0.1249 | fixed |
| count_birth_order3/5+ | -0.06706 | 0.134 | -0.5004 | -0.3297 | 0.1956 | fixed |
| count_birth_order4/5+ | -0.1438 | 0.1262 | -1.14 | -0.3911 | 0.1034 | fixed |
| count_birth_order5/5+ | -0.2396 | 0.1213 | -1.974 | -0.4774 | -0.001747 | fixed |
| count_birth_order5+/5+ | -0.1037 | 0.09056 | -1.145 | -0.2812 | 0.0738 | fixed |
| sd_(Intercept).mother_pidlink | 0.261 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.9711 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 7066 | 7130 | -3522 | 7044 | NA | NA | NA |
| 12 | 7067 | 7137 | -3522 | 7043 | 0.4305 | 1 | 0.5117 |
| 16 | 7070 | 7163 | -3519 | 7038 | 4.865 | 4 | 0.3014 |
| 26 | 7082 | 7233 | -3515 | 7030 | 8.758 | 10 | 0.5552 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = Self_employed)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.2665 | 0.095 | -2.805 | -0.4527 | -0.08029 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02362 | 0.008521 | 2.772 | 0.006922 | 0.04033 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001646 | 0.0002393 | -0.6879 | -0.0006336 | 0.0003044 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000002153 | 0.000002126 | -0.1013 | -0.000004382 | 0.000003952 | fixed |
| male | -0.002977 | 0.008766 | -0.3396 | -0.02016 | 0.0142 | fixed |
| sibling_count3 | -0.02246 | 0.01828 | -1.229 | -0.05828 | 0.01337 | fixed |
| sibling_count4 | -0.01987 | 0.01844 | -1.077 | -0.056 | 0.01627 | fixed |
| sibling_count5 | -0.01023 | 0.01921 | -0.5326 | -0.04789 | 0.02743 | fixed |
| sibling_count5+ | 0.01732 | 0.0149 | 1.162 | -0.01188 | 0.04651 | fixed |
| sd_(Intercept).mother_pidlink | 0.1531 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4098 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.2668 | 0.09499 | -2.809 | -0.453 | -0.08063 | fixed |
| birth_order | 0.002029 | 0.001784 | 1.137 | -0.001469 | 0.005526 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02307 | 0.008535 | 2.703 | 0.006339 | 0.0398 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001441 | 0.00024 | -0.6006 | -0.0006145 | 0.0003262 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000004013 | 0.000002132 | -0.1882 | -0.00000458 | 0.000003778 | fixed |
| male | -0.003007 | 0.008766 | -0.3431 | -0.02019 | 0.01417 | fixed |
| sibling_count3 | -0.023 | 0.01828 | -1.258 | -0.05884 | 0.01283 | fixed |
| sibling_count4 | -0.0211 | 0.01847 | -1.143 | -0.0573 | 0.01509 | fixed |
| sibling_count5 | -0.01241 | 0.01931 | -0.6426 | -0.05025 | 0.02544 | fixed |
| sibling_count5+ | 0.01022 | 0.01615 | 0.6328 | -0.02144 | 0.04188 | fixed |
| sd_(Intercept).mother_pidlink | 0.1529 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4098 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.2752 | 0.09511 | -2.893 | -0.4616 | -0.08877 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02319 | 0.008541 | 2.715 | 0.00645 | 0.03993 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001598 | 0.0002401 | -0.6657 | -0.0006303 | 0.0003107 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000001582 | 0.000002133 | -0.07415 | -0.000004338 | 0.000004022 | fixed |
| male | -0.003111 | 0.008765 | -0.3549 | -0.02029 | 0.01407 | fixed |
| sibling_count3 | -0.02462 | 0.01855 | -1.327 | -0.06098 | 0.01173 | fixed |
| sibling_count4 | -0.02199 | 0.01896 | -1.16 | -0.05915 | 0.01517 | fixed |
| sibling_count5 | -0.01296 | 0.01996 | -0.6493 | -0.05208 | 0.02616 | fixed |
| sibling_count5+ | 0.01309 | 0.01691 | 0.7741 | -0.02005 | 0.04623 | fixed |
| birth_order_nonlinear2 | 0.03823 | 0.01276 | 2.997 | 0.01323 | 0.06324 | fixed |
| birth_order_nonlinear3 | 0.01961 | 0.01483 | 1.322 | -0.009457 | 0.04867 | fixed |
| birth_order_nonlinear4 | 0.0146 | 0.01665 | 0.877 | -0.01803 | 0.04724 | fixed |
| birth_order_nonlinear5 | 0.01968 | 0.01874 | 1.05 | -0.01704 | 0.0564 | fixed |
| birth_order_nonlinear5+ | 0.02218 | 0.01558 | 1.423 | -0.008359 | 0.05271 | fixed |
| sd_(Intercept).mother_pidlink | 0.1529 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4097 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.2834 | 0.09546 | -2.969 | -0.4705 | -0.09631 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02291 | 0.008548 | 2.68 | 0.006152 | 0.03966 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001582 | 0.0002402 | -0.6585 | -0.000629 | 0.0003126 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000000111 | 0.000002134 | -0.052 | -0.000004293 | 0.000004072 | fixed |
| male | -0.003372 | 0.008769 | -0.3845 | -0.02056 | 0.01382 | fixed |
| count_birth_order2/2 | 0.07421 | 0.02534 | 2.928 | 0.02454 | 0.1239 | fixed |
| count_birth_order1/3 | -0.02418 | 0.02456 | -0.9844 | -0.07231 | 0.02396 | fixed |
| count_birth_order2/3 | 0.03323 | 0.02722 | 1.221 | -0.02011 | 0.08657 | fixed |
| count_birth_order3/3 | 0.02459 | 0.02989 | 0.8229 | -0.03398 | 0.08317 | fixed |
| count_birth_order1/4 | 0.01501 | 0.0269 | 0.5579 | -0.03772 | 0.06773 | fixed |
| count_birth_order2/4 | 0.005201 | 0.02884 | 0.1804 | -0.05132 | 0.06173 | fixed |
| count_birth_order3/4 | -0.005191 | 0.03075 | -0.1688 | -0.06545 | 0.05507 | fixed |
| count_birth_order4/4 | 0.01914 | 0.03266 | 0.5862 | -0.04486 | 0.08315 | fixed |
| count_birth_order1/5 | 0.009117 | 0.03054 | 0.2985 | -0.05074 | 0.06897 | fixed |
| count_birth_order2/5 | 0.04643 | 0.03238 | 1.434 | -0.01704 | 0.1099 | fixed |
| count_birth_order3/5 | 0.03461 | 0.03409 | 1.015 | -0.0322 | 0.1014 | fixed |
| count_birth_order4/5 | -0.01429 | 0.03583 | -0.3989 | -0.08451 | 0.05593 | fixed |
| count_birth_order5/5 | 0.0102 | 0.03582 | 0.2846 | -0.06001 | 0.0804 | fixed |
| count_birth_order1/5+ | 0.03492 | 0.02352 | 1.485 | -0.01118 | 0.08102 | fixed |
| count_birth_order2/5+ | 0.05428 | 0.02449 | 2.216 | 0.006268 | 0.1023 | fixed |
| count_birth_order3/5+ | 0.04115 | 0.02413 | 1.705 | -0.006149 | 0.08844 | fixed |
| count_birth_order4/5+ | 0.04521 | 0.0237 | 1.907 | -0.001244 | 0.09166 | fixed |
| count_birth_order5/5+ | 0.04958 | 0.02396 | 2.069 | 0.002613 | 0.09655 | fixed |
| count_birth_order5+/5+ | 0.04898 | 0.01941 | 2.523 | 0.01094 | 0.08703 | fixed |
| sd_(Intercept).mother_pidlink | 0.153 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4097 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 11871 | 11950 | -5924 | 11849 | NA | NA | NA |
| 12 | 11871 | 11958 | -5924 | 11847 | 1.295 | 1 | 0.2552 |
| 16 | 11872 | 11987 | -5920 | 11840 | 7.919 | 4 | 0.0946 |
| 26 | 11883 | 12071 | -5916 | 11831 | 8.217 | 10 | 0.6077 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9428 | 0.2612 | 3.609 | 0.4307 | 1.455 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1058 | 0.02805 | -3.773 | -0.1608 | -0.05087 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.004147 | 0.0009623 | 4.309 | 0.002261 | 0.006033 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004614 | 0.00001056 | -4.368 | -0.00006685 | -0.00002544 | fixed |
| male | -0.02367 | 0.01315 | -1.8 | -0.04943 | 0.0021 | fixed |
| sibling_count3 | 0.01552 | 0.02194 | 0.7075 | -0.02747 | 0.05851 | fixed |
| sibling_count4 | -0.02907 | 0.02271 | -1.28 | -0.07358 | 0.01545 | fixed |
| sibling_count5 | 0.03856 | 0.02531 | 1.524 | -0.01104 | 0.08815 | fixed |
| sibling_count5+ | 0.04773 | 0.02198 | 2.172 | 0.00465 | 0.09081 | fixed |
| sd_(Intercept).mother_pidlink | 0.1578 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3721 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9413 | 0.2613 | 3.602 | 0.4291 | 1.453 | fixed |
| birth_order | -0.001447 | 0.004107 | -0.3524 | -0.009497 | 0.006603 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1055 | 0.02807 | -3.759 | -0.1605 | -0.05049 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.004138 | 0.0009626 | 4.299 | 0.002251 | 0.006025 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004611 | 0.00001057 | -4.364 | -0.00006682 | -0.0000254 | fixed |
| male | -0.02362 | 0.01315 | -1.796 | -0.04939 | 0.002152 | fixed |
| sibling_count3 | 0.01627 | 0.02204 | 0.7382 | -0.02693 | 0.05948 | fixed |
| sibling_count4 | -0.02744 | 0.02318 | -1.184 | -0.07288 | 0.01799 | fixed |
| sibling_count5 | 0.0412 | 0.02642 | 1.559 | -0.01058 | 0.09299 | fixed |
| sibling_count5+ | 0.05295 | 0.02654 | 1.995 | 0.0009406 | 0.105 | fixed |
| sd_(Intercept).mother_pidlink | 0.1582 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.372 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9329 | 0.2617 | 3.565 | 0.42 | 1.446 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1051 | 0.02809 | -3.742 | -0.1602 | -0.05006 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.004127 | 0.0009634 | 4.283 | 0.002238 | 0.006015 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004607 | 0.00001058 | -4.355 | -0.0000668 | -0.00002534 | fixed |
| male | -0.02352 | 0.01315 | -1.788 | -0.0493 | 0.002267 | fixed |
| sibling_count3 | 0.0156 | 0.02247 | 0.6942 | -0.02844 | 0.05964 | fixed |
| sibling_count4 | -0.02767 | 0.02398 | -1.154 | -0.07467 | 0.01933 | fixed |
| sibling_count5 | 0.04284 | 0.02763 | 1.55 | -0.01132 | 0.09699 | fixed |
| sibling_count5+ | 0.0613 | 0.02722 | 2.252 | 0.007956 | 0.1147 | fixed |
| birth_order_nonlinear2 | 0.01025 | 0.01727 | 0.5934 | -0.02361 | 0.04411 | fixed |
| birth_order_nonlinear3 | 0.001374 | 0.02033 | 0.06759 | -0.03848 | 0.04123 | fixed |
| birth_order_nonlinear4 | -0.002639 | 0.02479 | -0.1065 | -0.05122 | 0.04594 | fixed |
| birth_order_nonlinear5 | -0.008891 | 0.03048 | -0.2917 | -0.06864 | 0.05086 | fixed |
| birth_order_nonlinear5+ | -0.02557 | 0.03043 | -0.8404 | -0.08522 | 0.03407 | fixed |
| sd_(Intercept).mother_pidlink | 0.1581 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3722 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9316 | 0.2628 | 3.545 | 0.4166 | 1.447 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1065 | 0.02821 | -3.774 | -0.1618 | -0.05117 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.004174 | 0.0009678 | 4.313 | 0.002277 | 0.006071 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004658 | 0.00001063 | -4.383 | -0.00006741 | -0.00002575 | fixed |
| male | -0.02415 | 0.01318 | -1.832 | -0.04998 | 0.001684 | fixed |
| count_birth_order2/2 | 0.05231 | 0.0336 | 1.557 | -0.01355 | 0.1182 | fixed |
| count_birth_order1/3 | 0.03981 | 0.02861 | 1.392 | -0.01626 | 0.09589 | fixed |
| count_birth_order2/3 | 0.03881 | 0.03176 | 1.222 | -0.02344 | 0.1011 | fixed |
| count_birth_order3/3 | 0.01045 | 0.03434 | 0.3044 | -0.05685 | 0.07775 | fixed |
| count_birth_order1/4 | -0.008259 | 0.03285 | -0.2514 | -0.07264 | 0.05612 | fixed |
| count_birth_order2/4 | -0.02985 | 0.03453 | -0.8646 | -0.09752 | 0.03782 | fixed |
| count_birth_order3/4 | -0.01272 | 0.0362 | -0.3513 | -0.08366 | 0.05823 | fixed |
| count_birth_order4/4 | 0.008705 | 0.03839 | 0.2267 | -0.06654 | 0.08395 | fixed |
| count_birth_order1/5 | 0.05321 | 0.04307 | 1.235 | -0.03121 | 0.1376 | fixed |
| count_birth_order2/5 | 0.07654 | 0.04684 | 1.634 | -0.01527 | 0.1684 | fixed |
| count_birth_order3/5 | 0.06749 | 0.04389 | 1.538 | -0.01854 | 0.1535 | fixed |
| count_birth_order4/5 | 0.05473 | 0.04269 | 1.282 | -0.02895 | 0.1384 | fixed |
| count_birth_order5/5 | 0.02978 | 0.04476 | 0.6652 | -0.05796 | 0.1175 | fixed |
| count_birth_order1/5+ | 0.07785 | 0.04095 | 1.901 | -0.002414 | 0.1581 | fixed |
| count_birth_order2/5+ | 0.07465 | 0.04131 | 1.807 | -0.006317 | 0.1556 | fixed |
| count_birth_order3/5+ | 0.09799 | 0.04038 | 2.426 | 0.01884 | 0.1771 | fixed |
| count_birth_order4/5+ | 0.04506 | 0.03922 | 1.149 | -0.0318 | 0.1219 | fixed |
| count_birth_order5/5+ | 0.07709 | 0.03782 | 2.038 | 0.00296 | 0.1512 | fixed |
| count_birth_order5+/5+ | 0.04905 | 0.0296 | 1.657 | -0.008953 | 0.1071 | fixed |
| sd_(Intercept).mother_pidlink | 0.1579 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3725 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 3908 | 3977 | -1943 | 3886 | NA | NA | NA |
| 12 | 3910 | 3985 | -1943 | 3886 | 0.122 | 1 | 0.7269 |
| 16 | 3917 | 4017 | -1942 | 3885 | 1.352 | 4 | 0.8525 |
| 26 | 3931 | 4094 | -1940 | 3879 | 5.638 | 10 | 0.8447 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.917 | 0.2603 | 3.523 | 0.4068 | 1.427 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1019 | 0.02798 | -3.642 | -0.1567 | -0.04707 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.004027 | 0.0009598 | 4.196 | 0.002146 | 0.005909 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004496 | 0.00001054 | -4.266 | -0.00006562 | -0.0000243 | fixed |
| male | -0.02421 | 0.01311 | -1.847 | -0.04991 | 0.001481 | fixed |
| sibling_count3 | -0.006695 | 0.02405 | -0.2784 | -0.05383 | 0.04044 | fixed |
| sibling_count4 | -0.03614 | 0.02428 | -1.489 | -0.08372 | 0.01144 | fixed |
| sibling_count5 | -0.008562 | 0.02563 | -0.3341 | -0.05879 | 0.04167 | fixed |
| sibling_count5+ | 0.0278 | 0.02245 | 1.238 | -0.0162 | 0.0718 | fixed |
| sd_(Intercept).mother_pidlink | 0.1587 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.372 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9174 | 0.2603 | 3.524 | 0.4071 | 1.428 | fixed |
| birth_order | 0.0004435 | 0.003628 | 0.1222 | -0.006668 | 0.007555 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.102 | 0.02799 | -3.644 | -0.1568 | -0.04713 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00403 | 0.0009601 | 4.197 | 0.002148 | 0.005911 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004497 | 0.00001054 | -4.266 | -0.00006563 | -0.00002431 | fixed |
| male | -0.02422 | 0.01311 | -1.848 | -0.04992 | 0.001474 | fixed |
| sibling_count3 | -0.006931 | 0.02413 | -0.2872 | -0.05422 | 0.04036 | fixed |
| sibling_count4 | -0.03661 | 0.02457 | -1.49 | -0.08477 | 0.01156 | fixed |
| sibling_count5 | -0.009323 | 0.02638 | -0.3534 | -0.06102 | 0.04238 | fixed |
| sibling_count5+ | 0.02623 | 0.02589 | 1.013 | -0.02451 | 0.07696 | fixed |
| sd_(Intercept).mother_pidlink | 0.1587 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3721 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9044 | 0.2607 | 3.47 | 0.3935 | 1.415 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1011 | 0.02801 | -3.608 | -0.156 | -0.04616 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003996 | 0.0009609 | 4.159 | 0.002113 | 0.00588 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004462 | 0.00001055 | -4.229 | -0.00006531 | -0.00002394 | fixed |
| male | -0.02403 | 0.01312 | -1.832 | -0.04974 | 0.001677 | fixed |
| sibling_count3 | -0.01015 | 0.02454 | -0.4134 | -0.05824 | 0.03795 | fixed |
| sibling_count4 | -0.03844 | 0.02528 | -1.521 | -0.08799 | 0.0111 | fixed |
| sibling_count5 | -0.008874 | 0.02749 | -0.3228 | -0.06275 | 0.04501 | fixed |
| sibling_count5+ | 0.02904 | 0.02661 | 1.091 | -0.02311 | 0.08119 | fixed |
| birth_order_nonlinear2 | 0.01753 | 0.01751 | 1.001 | -0.01679 | 0.05185 | fixed |
| birth_order_nonlinear3 | 0.01558 | 0.02045 | 0.7616 | -0.02451 | 0.05566 | fixed |
| birth_order_nonlinear4 | -0.00005852 | 0.0242 | -0.002418 | -0.04749 | 0.04737 | fixed |
| birth_order_nonlinear5 | -0.002062 | 0.02949 | -0.06994 | -0.05986 | 0.05573 | fixed |
| birth_order_nonlinear5+ | 0.002764 | 0.02752 | 0.1004 | -0.05118 | 0.05671 | fixed |
| sd_(Intercept).mother_pidlink | 0.1585 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3722 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.904 | 0.2612 | 3.46 | 0.392 | 1.416 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1033 | 0.02807 | -3.68 | -0.1583 | -0.04828 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.004077 | 0.0009634 | 4.233 | 0.002189 | 0.005966 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004555 | 0.00001058 | -4.305 | -0.00006629 | -0.00002481 | fixed |
| male | -0.02482 | 0.01313 | -1.89 | -0.05057 | 0.0009199 | fixed |
| count_birth_order2/2 | 0.07947 | 0.03699 | 2.148 | 0.006965 | 0.152 | fixed |
| count_birth_order1/3 | 0.02032 | 0.0316 | 0.643 | -0.04161 | 0.08225 | fixed |
| count_birth_order2/3 | 0.04303 | 0.03437 | 1.252 | -0.02433 | 0.1104 | fixed |
| count_birth_order3/3 | -0.015 | 0.03778 | -0.3971 | -0.08904 | 0.05904 | fixed |
| count_birth_order1/4 | 0.005795 | 0.03435 | 0.1687 | -0.06153 | 0.07312 | fixed |
| count_birth_order2/4 | -0.0307 | 0.03584 | -0.8566 | -0.1009 | 0.03954 | fixed |
| count_birth_order3/4 | -0.0108 | 0.03917 | -0.2758 | -0.08757 | 0.06596 | fixed |
| count_birth_order4/4 | -0.006404 | 0.04181 | -0.1532 | -0.08835 | 0.07554 | fixed |
| count_birth_order1/5 | 0.01609 | 0.04117 | 0.3908 | -0.0646 | 0.09678 | fixed |
| count_birth_order2/5 | 0.01692 | 0.04276 | 0.3957 | -0.06688 | 0.1007 | fixed |
| count_birth_order3/5 | 0.01622 | 0.04352 | 0.3728 | -0.06907 | 0.1015 | fixed |
| count_birth_order4/5 | 0.01776 | 0.04424 | 0.4013 | -0.06896 | 0.1045 | fixed |
| count_birth_order5/5 | 0.02105 | 0.04457 | 0.4723 | -0.0663 | 0.1084 | fixed |
| count_birth_order1/5+ | 0.03557 | 0.03723 | 0.9554 | -0.0374 | 0.1085 | fixed |
| count_birth_order2/5+ | 0.04765 | 0.03933 | 1.211 | -0.02944 | 0.1247 | fixed |
| count_birth_order3/5+ | 0.1171 | 0.03789 | 3.092 | 0.04288 | 0.1914 | fixed |
| count_birth_order4/5+ | 0.03739 | 0.03695 | 1.012 | -0.03504 | 0.1098 | fixed |
| count_birth_order5/5+ | 0.03913 | 0.03908 | 1.001 | -0.03746 | 0.1157 | fixed |
| count_birth_order5+/5+ | 0.05174 | 0.02961 | 1.747 | -0.006299 | 0.1098 | fixed |
| sd_(Intercept).mother_pidlink | 0.1582 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3723 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 3939 | 4008 | -1958 | 3917 | NA | NA | NA |
| 12 | 3941 | 4016 | -1958 | 3917 | 0.01549 | 1 | 0.901 |
| 16 | 3947 | 4047 | -1958 | 3915 | 1.543 | 4 | 0.8189 |
| 26 | 3955 | 4118 | -1952 | 3903 | 11.8 | 10 | 0.2988 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9712 | 0.2646 | 3.67 | 0.4525 | 1.49 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.11 | 0.02846 | -3.864 | -0.1657 | -0.05418 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.004334 | 0.0009771 | 4.435 | 0.002418 | 0.006249 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004871 | 0.00001074 | -4.536 | -0.00006976 | -0.00002766 | fixed |
| male | -0.02276 | 0.0133 | -1.711 | -0.04883 | 0.003314 | fixed |
| sibling_count3 | 0.02252 | 0.02157 | 1.044 | -0.01976 | 0.06479 | fixed |
| sibling_count4 | -0.02657 | 0.02265 | -1.173 | -0.07097 | 0.01783 | fixed |
| sibling_count5 | 0.03133 | 0.02594 | 1.208 | -0.01952 | 0.08218 | fixed |
| sibling_count5+ | 0.04105 | 0.02217 | 1.852 | -0.002396 | 0.0845 | fixed |
| sd_(Intercept).mother_pidlink | 0.16 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3726 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9698 | 0.2647 | 3.663 | 0.4509 | 1.489 | fixed |
| birth_order | -0.001067 | 0.004238 | -0.2517 | -0.009373 | 0.007239 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1097 | 0.02848 | -3.851 | -0.1655 | -0.05385 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.004326 | 0.0009776 | 4.425 | 0.00241 | 0.006242 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004867 | 0.00001074 | -4.531 | -0.00006973 | -0.00002762 | fixed |
| male | -0.02275 | 0.0133 | -1.71 | -0.04882 | 0.00333 | fixed |
| sibling_count3 | 0.02308 | 0.02169 | 1.064 | -0.01943 | 0.0656 | fixed |
| sibling_count4 | -0.02539 | 0.02314 | -1.097 | -0.07074 | 0.01996 | fixed |
| sibling_count5 | 0.03322 | 0.02704 | 1.229 | -0.01977 | 0.08622 | fixed |
| sibling_count5+ | 0.0449 | 0.02695 | 1.666 | -0.007923 | 0.09772 | fixed |
| sd_(Intercept).mother_pidlink | 0.1602 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3725 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9616 | 0.2651 | 3.628 | 0.4421 | 1.481 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1091 | 0.0285 | -3.828 | -0.165 | -0.05323 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00431 | 0.0009784 | 4.405 | 0.002392 | 0.006227 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004859 | 0.00001075 | -4.519 | -0.00006966 | -0.00002751 | fixed |
| male | -0.02281 | 0.01331 | -1.713 | -0.0489 | 0.003284 | fixed |
| sibling_count3 | 0.02313 | 0.02213 | 1.045 | -0.02025 | 0.06651 | fixed |
| sibling_count4 | -0.02585 | 0.02394 | -1.08 | -0.07278 | 0.02107 | fixed |
| sibling_count5 | 0.03196 | 0.02818 | 1.134 | -0.02328 | 0.08719 | fixed |
| sibling_count5+ | 0.05248 | 0.02768 | 1.896 | -0.001773 | 0.1067 | fixed |
| birth_order_nonlinear2 | 0.004606 | 0.01724 | 0.2672 | -0.02918 | 0.03839 | fixed |
| birth_order_nonlinear3 | -0.001029 | 0.02041 | -0.0504 | -0.04103 | 0.03897 | fixed |
| birth_order_nonlinear4 | 0.001722 | 0.02559 | 0.06727 | -0.04844 | 0.05189 | fixed |
| birth_order_nonlinear5 | 0.003465 | 0.03152 | 0.1099 | -0.05832 | 0.06525 | fixed |
| birth_order_nonlinear5+ | -0.02943 | 0.03147 | -0.9352 | -0.09112 | 0.03225 | fixed |
| sd_(Intercept).mother_pidlink | 0.1602 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3727 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9503 | 0.266 | 3.573 | 0.429 | 1.472 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1092 | 0.0286 | -3.819 | -0.1653 | -0.05318 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.004316 | 0.0009823 | 4.394 | 0.002391 | 0.006241 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004867 | 0.0000108 | -4.507 | -0.00006983 | -0.00002751 | fixed |
| male | -0.0234 | 0.01334 | -1.754 | -0.04954 | 0.002743 | fixed |
| count_birth_order2/2 | 0.0426 | 0.03271 | 1.302 | -0.02152 | 0.1067 | fixed |
| count_birth_order1/3 | 0.04535 | 0.0282 | 1.608 | -0.009916 | 0.1006 | fixed |
| count_birth_order2/3 | 0.04406 | 0.03134 | 1.406 | -0.01736 | 0.1055 | fixed |
| count_birth_order3/3 | 0.01164 | 0.03353 | 0.3472 | -0.05408 | 0.07737 | fixed |
| count_birth_order1/4 | -0.008358 | 0.03305 | -0.2528 | -0.07314 | 0.05643 | fixed |
| count_birth_order2/4 | -0.04096 | 0.03452 | -1.187 | -0.1086 | 0.0267 | fixed |
| count_birth_order3/4 | -0.01007 | 0.03618 | -0.2784 | -0.08097 | 0.06083 | fixed |
| count_birth_order4/4 | 0.02124 | 0.03901 | 0.5443 | -0.05522 | 0.09769 | fixed |
| count_birth_order1/5 | 0.0574 | 0.04322 | 1.328 | -0.02731 | 0.1421 | fixed |
| count_birth_order2/5 | 0.07243 | 0.04845 | 1.495 | -0.02254 | 0.1674 | fixed |
| count_birth_order3/5 | 0.0487 | 0.04642 | 1.049 | -0.04227 | 0.1397 | fixed |
| count_birth_order4/5 | 0.03821 | 0.04477 | 0.8534 | -0.04954 | 0.126 | fixed |
| count_birth_order5/5 | 0.0122 | 0.04712 | 0.2589 | -0.08016 | 0.1046 | fixed |
| count_birth_order1/5+ | 0.05652 | 0.0421 | 1.342 | -0.026 | 0.139 | fixed |
| count_birth_order2/5+ | 0.05222 | 0.04261 | 1.225 | -0.0313 | 0.1357 | fixed |
| count_birth_order3/5+ | 0.09224 | 0.04079 | 2.261 | 0.01228 | 0.1722 | fixed |
| count_birth_order4/5+ | 0.03775 | 0.04057 | 0.9304 | -0.04177 | 0.1173 | fixed |
| count_birth_order5/5+ | 0.0893 | 0.0384 | 2.326 | 0.01404 | 0.1646 | fixed |
| count_birth_order5+/5+ | 0.0354 | 0.0301 | 1.176 | -0.02359 | 0.09438 | fixed |
| sd_(Intercept).mother_pidlink | 0.1598 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3729 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 3861 | 3930 | -1919 | 3839 | NA | NA | NA |
| 12 | 3863 | 3938 | -1919 | 3839 | 0.06169 | 1 | 0.8038 |
| 16 | 3870 | 3969 | -1919 | 3838 | 1.332 | 4 | 0.856 |
| 26 | 3882 | 4044 | -1915 | 3830 | 8.08 | 10 | 0.6211 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = `Category_Casual worker in agriculture`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.06852 | 0.03525 | 1.944 | -0.0005704 | 0.1376 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.004585 | 0.003161 | -1.45 | -0.01078 | 0.001611 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001275 | 0.00008876 | 1.437 | -0.00004643 | 0.0003015 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000009703 | 0.0000007884 | -1.231 | -0.000002516 | 0.000000575 | fixed |
| male | 0.0003999 | 0.003258 | 0.1228 | -0.005985 | 0.006785 | fixed |
| sibling_count3 | -0.00296 | 0.006763 | -0.4378 | -0.01622 | 0.01029 | fixed |
| sibling_count4 | 0.005901 | 0.00682 | 0.8653 | -0.007465 | 0.01927 | fixed |
| sibling_count5 | -0.002795 | 0.007104 | -0.3935 | -0.01672 | 0.01113 | fixed |
| sibling_count5+ | 0.008566 | 0.005512 | 1.554 | -0.002237 | 0.01937 | fixed |
| sd_(Intercept).mother_pidlink | 0.05392 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1531 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.06862 | 0.03525 | 1.947 | -0.0004662 | 0.1377 | fixed |
| birth_order | -0.0009169 | 0.0006614 | -1.386 | -0.002213 | 0.0003793 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.004333 | 0.003167 | -1.368 | -0.01054 | 0.001873 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001183 | 0.00008901 | 1.329 | -0.00005613 | 0.0002928 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000008869 | 0.0000007907 | -1.122 | -0.000002437 | 0.0000006629 | fixed |
| male | 0.0004145 | 0.003257 | 0.1273 | -0.00597 | 0.006799 | fixed |
| sibling_count3 | -0.00271 | 0.006766 | -0.4005 | -0.01597 | 0.01055 | fixed |
| sibling_count4 | 0.006467 | 0.006833 | 0.9464 | -0.006925 | 0.01986 | fixed |
| sibling_count5 | -0.001804 | 0.007141 | -0.2526 | -0.0158 | 0.01219 | fixed |
| sibling_count5+ | 0.01179 | 0.005981 | 1.971 | 0.00006478 | 0.02351 | fixed |
| sd_(Intercept).mother_pidlink | 0.05405 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.153 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.0684 | 0.03531 | 1.937 | -0.000797 | 0.1376 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.004322 | 0.00317 | -1.364 | -0.01053 | 0.001891 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001208 | 0.00008907 | 1.357 | -0.00005374 | 0.0002954 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000009306 | 0.0000007912 | -1.176 | -0.000002481 | 0.0000006201 | fixed |
| male | 0.0004062 | 0.003258 | 0.1247 | -0.00598 | 0.006792 | fixed |
| sibling_count3 | -0.002613 | 0.006868 | -0.3805 | -0.01607 | 0.01085 | fixed |
| sibling_count4 | 0.007246 | 0.007019 | 1.032 | -0.006511 | 0.021 | fixed |
| sibling_count5 | -0.001002 | 0.007388 | -0.1356 | -0.01548 | 0.01348 | fixed |
| sibling_count5+ | 0.01129 | 0.006267 | 1.801 | -0.0009978 | 0.02357 | fixed |
| birth_order_nonlinear2 | -0.00616 | 0.004749 | -1.297 | -0.01547 | 0.003147 | fixed |
| birth_order_nonlinear3 | -0.003442 | 0.00552 | -0.6236 | -0.01426 | 0.007377 | fixed |
| birth_order_nonlinear4 | -0.008114 | 0.006198 | -1.309 | -0.02026 | 0.004034 | fixed |
| birth_order_nonlinear5 | -0.006216 | 0.006973 | -0.8915 | -0.01988 | 0.007451 | fixed |
| birth_order_nonlinear5+ | -0.006247 | 0.005788 | -1.079 | -0.01759 | 0.005097 | fixed |
| sd_(Intercept).mother_pidlink | 0.05398 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1531 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.07183 | 0.03542 | 2.028 | 0.002406 | 0.1413 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.004317 | 0.003172 | -1.361 | -0.01053 | 0.001899 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001217 | 0.0000891 | 1.366 | -0.00005296 | 0.0002963 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000009483 | 0.0000007913 | -1.198 | -0.000002499 | 0.0000006027 | fixed |
| male | 0.0003518 | 0.003259 | 0.1079 | -0.006036 | 0.00674 | fixed |
| count_birth_order2/2 | -0.01611 | 0.009432 | -1.708 | -0.03459 | 0.002377 | fixed |
| count_birth_order1/3 | -0.007027 | 0.009116 | -0.7708 | -0.02489 | 0.01084 | fixed |
| count_birth_order2/3 | -0.006682 | 0.0101 | -0.6613 | -0.02649 | 0.01312 | fixed |
| count_birth_order3/3 | -0.01617 | 0.0111 | -1.457 | -0.03792 | 0.005584 | fixed |
| count_birth_order1/4 | -0.007734 | 0.009987 | -0.7744 | -0.02731 | 0.01184 | fixed |
| count_birth_order2/4 | -0.003666 | 0.01071 | -0.3423 | -0.02465 | 0.01732 | fixed |
| count_birth_order3/4 | 0.01068 | 0.01142 | 0.935 | -0.0117 | 0.03305 | fixed |
| count_birth_order4/4 | 0.00423 | 0.01213 | 0.3488 | -0.01954 | 0.028 | fixed |
| count_birth_order1/5 | 0.002099 | 0.01134 | 0.1851 | -0.02013 | 0.02433 | fixed |
| count_birth_order2/5 | -0.01472 | 0.01203 | -1.224 | -0.03829 | 0.008845 | fixed |
| count_birth_order3/5 | -0.02292 | 0.01266 | -1.81 | -0.04773 | 0.001896 | fixed |
| count_birth_order4/5 | 0.003402 | 0.01331 | 0.2556 | -0.02268 | 0.02948 | fixed |
| count_birth_order5/5 | -0.01578 | 0.0133 | -1.186 | -0.04186 | 0.01029 | fixed |
| count_birth_order1/5+ | 0.007944 | 0.008735 | 0.9094 | -0.009177 | 0.02506 | fixed |
| count_birth_order2/5+ | 0.004563 | 0.009098 | 0.5016 | -0.01327 | 0.02239 | fixed |
| count_birth_order3/5+ | 0.007596 | 0.008963 | 0.8475 | -0.009971 | 0.02516 | fixed |
| count_birth_order4/5+ | -0.008504 | 0.008802 | -0.9661 | -0.02576 | 0.008748 | fixed |
| count_birth_order5/5+ | 0.002768 | 0.008901 | 0.311 | -0.01468 | 0.02021 | fixed |
| count_birth_order5+/5+ | 0.001264 | 0.007196 | 0.1757 | -0.01284 | 0.01537 | fixed |
| sd_(Intercept).mother_pidlink | 0.05386 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1531 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -8128 | -8049 | 4075 | -8150 | NA | NA | NA |
| 12 | -8128 | -8041 | 4076 | -8152 | 1.92 | 1 | 0.1659 |
| 16 | -8121 | -8005 | 4076 | -8153 | 0.7708 | 4 | 0.9423 |
| 26 | -8114 | -7926 | 4083 | -8166 | 13.04 | 10 | 0.2216 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.01952 | 0.07867 | 0.2481 | -0.1347 | 0.1737 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.001255 | 0.008445 | 0.1486 | -0.0153 | 0.01781 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001097 | 0.0002896 | -0.3787 | -0.0006773 | 0.000458 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000001805 | 0.000003179 | 0.5676 | -0.000004427 | 0.000008036 | fixed |
| male | 0.003915 | 0.003952 | 0.9909 | -0.003829 | 0.01166 | fixed |
| sibling_count3 | -0.005883 | 0.006687 | -0.8798 | -0.01899 | 0.007224 | fixed |
| sibling_count4 | 0.0002679 | 0.006935 | 0.03863 | -0.01332 | 0.01386 | fixed |
| sibling_count5 | -0.007085 | 0.007746 | -0.9147 | -0.02227 | 0.008096 | fixed |
| sibling_count5+ | 0.01689 | 0.006728 | 2.51 | 0.003703 | 0.03008 | fixed |
| sd_(Intercept).mother_pidlink | 0.05521 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1091 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.02063 | 0.07869 | 0.2622 | -0.1336 | 0.1749 | fixed |
| birth_order | 0.0009961 | 0.001241 | 0.803 | -0.001435 | 0.003427 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.001006 | 0.008451 | 0.119 | -0.01556 | 0.01757 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001032 | 0.0002898 | -0.3563 | -0.0006711 | 0.0004647 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000001779 | 0.00000318 | 0.5595 | -0.000004453 | 0.000008011 | fixed |
| male | 0.003886 | 0.003952 | 0.9833 | -0.00386 | 0.01163 | fixed |
| sibling_count3 | -0.006403 | 0.006718 | -0.953 | -0.01957 | 0.006765 | fixed |
| sibling_count4 | -0.0008584 | 0.007075 | -0.1213 | -0.01473 | 0.01301 | fixed |
| sibling_count5 | -0.008934 | 0.00808 | -1.106 | -0.02477 | 0.006903 | fixed |
| sibling_count5+ | 0.01326 | 0.008107 | 1.635 | -0.002634 | 0.02915 | fixed |
| sd_(Intercept).mother_pidlink | 0.05515 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1091 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.02295 | 0.07878 | 0.2913 | -0.1315 | 0.1773 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0008336 | 0.008454 | 0.0986 | -0.01574 | 0.0174 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0000993 | 0.0002899 | -0.3425 | -0.0006675 | 0.0004689 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000001774 | 0.000003182 | 0.5574 | -0.000004463 | 0.00000801 | fixed |
| male | 0.003896 | 0.003953 | 0.9856 | -0.003851 | 0.01164 | fixed |
| sibling_count3 | -0.005982 | 0.006841 | -0.8744 | -0.01939 | 0.007427 | fixed |
| sibling_count4 | -0.0002267 | 0.007308 | -0.03102 | -0.01455 | 0.0141 | fixed |
| sibling_count5 | -0.00734 | 0.008432 | -0.8706 | -0.02387 | 0.009185 | fixed |
| sibling_count5+ | 0.01131 | 0.008306 | 1.361 | -0.004973 | 0.02758 | fixed |
| birth_order_nonlinear2 | 0.002468 | 0.005159 | 0.4784 | -0.007644 | 0.01258 | fixed |
| birth_order_nonlinear3 | 0.0001147 | 0.006077 | 0.01887 | -0.0118 | 0.01203 | fixed |
| birth_order_nonlinear4 | 0.001705 | 0.007413 | 0.23 | -0.01282 | 0.01623 | fixed |
| birth_order_nonlinear5 | -0.0005972 | 0.009118 | -0.06549 | -0.01847 | 0.01727 | fixed |
| birth_order_nonlinear5+ | 0.0157 | 0.009163 | 1.713 | -0.002263 | 0.03365 | fixed |
| sd_(Intercept).mother_pidlink | 0.05527 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1091 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.02181 | 0.07903 | 0.276 | -0.1331 | 0.1767 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.001327 | 0.008482 | 0.1565 | -0.0153 | 0.01795 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001173 | 0.0002909 | -0.4032 | -0.0006875 | 0.0004529 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00000199 | 0.000003194 | 0.6231 | -0.00000427 | 0.000008251 | fixed |
| male | 0.003913 | 0.003957 | 0.989 | -0.003842 | 0.01167 | fixed |
| count_birth_order2/2 | -0.007885 | 0.01004 | -0.785 | -0.02757 | 0.0118 | fixed |
| count_birth_order1/3 | -0.01161 | 0.008624 | -1.346 | -0.02851 | 0.005296 | fixed |
| count_birth_order2/3 | -0.009642 | 0.009564 | -1.008 | -0.02839 | 0.009103 | fixed |
| count_birth_order3/3 | -0.001103 | 0.01033 | -0.1067 | -0.02136 | 0.01915 | fixed |
| count_birth_order1/4 | 0.001448 | 0.009895 | 0.1463 | -0.01795 | 0.02084 | fixed |
| count_birth_order2/4 | -0.001238 | 0.01039 | -0.1191 | -0.02161 | 0.01913 | fixed |
| count_birth_order3/4 | -0.0139 | 0.01089 | -1.277 | -0.03524 | 0.007441 | fixed |
| count_birth_order4/4 | 0.002229 | 0.01154 | 0.1931 | -0.0204 | 0.02486 | fixed |
| count_birth_order1/5 | -0.009352 | 0.01296 | -0.7215 | -0.03475 | 0.01605 | fixed |
| count_birth_order2/5 | -0.01508 | 0.01408 | -1.071 | -0.04266 | 0.01251 | fixed |
| count_birth_order3/5 | -0.01413 | 0.01319 | -1.071 | -0.03998 | 0.01173 | fixed |
| count_birth_order4/5 | 0.002559 | 0.01283 | 0.1994 | -0.02259 | 0.02771 | fixed |
| count_birth_order5/5 | -0.01591 | 0.01345 | -1.183 | -0.04227 | 0.01046 | fixed |
| count_birth_order1/5+ | -0.00645 | 0.01232 | -0.5237 | -0.03059 | 0.01769 | fixed |
| count_birth_order2/5+ | 0.03205 | 0.01241 | 2.582 | 0.007721 | 0.05638 | fixed |
| count_birth_order3/5+ | 0.01239 | 0.01213 | 1.022 | -0.01138 | 0.03617 | fixed |
| count_birth_order4/5+ | -0.003848 | 0.01178 | -0.3267 | -0.02693 | 0.01924 | fixed |
| count_birth_order5/5+ | 0.01032 | 0.01136 | 0.9085 | -0.01195 | 0.03259 | fixed |
| count_birth_order5+/5+ | 0.02363 | 0.008944 | 2.642 | 0.006101 | 0.04116 | fixed |
| sd_(Intercept).mother_pidlink | 0.05466 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1093 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -5280 | -5211 | 2651 | -5302 | NA | NA | NA |
| 12 | -5279 | -5203 | 2651 | -5303 | 0.6479 | 1 | 0.4209 |
| 16 | -5274 | -5174 | 2653 | -5306 | 3.207 | 4 | 0.5238 |
| 26 | -5268 | -5106 | 2660 | -5320 | 14.78 | 10 | 0.1402 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.01131 | 0.0782 | 0.1446 | -0.142 | 0.1646 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.002056 | 0.008402 | 0.2447 | -0.01441 | 0.01852 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001338 | 0.0002882 | -0.4642 | -0.0006987 | 0.0004311 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000002068 | 0.000003165 | 0.6536 | -0.000004134 | 0.000008271 | fixed |
| male | 0.003961 | 0.003931 | 1.007 | -0.003744 | 0.01167 | fixed |
| sibling_count3 | -0.003733 | 0.007306 | -0.5109 | -0.01805 | 0.01059 | fixed |
| sibling_count4 | -0.002881 | 0.007382 | -0.3903 | -0.01735 | 0.01159 | fixed |
| sibling_count5 | -0.005224 | 0.007806 | -0.6693 | -0.02052 | 0.01007 | fixed |
| sibling_count5+ | 0.00942 | 0.006833 | 1.379 | -0.003973 | 0.02281 | fixed |
| sd_(Intercept).mother_pidlink | 0.05499 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1089 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.01302 | 0.07819 | 0.1665 | -0.1402 | 0.1663 | fixed |
| birth_order | 0.001766 | 0.001094 | 1.613 | -0.0003795 | 0.003911 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.001647 | 0.008404 | 0.1959 | -0.01483 | 0.01812 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001235 | 0.0002882 | -0.4285 | -0.0006885 | 0.0004414 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000002037 | 0.000003164 | 0.6439 | -0.000004164 | 0.000008239 | fixed |
| male | 0.003919 | 0.003931 | 0.997 | -0.003785 | 0.01162 | fixed |
| sibling_count3 | -0.004682 | 0.007326 | -0.6391 | -0.01904 | 0.009677 | fixed |
| sibling_count4 | -0.004751 | 0.007469 | -0.6361 | -0.01939 | 0.009888 | fixed |
| sibling_count5 | -0.00828 | 0.008028 | -1.031 | -0.02402 | 0.007456 | fixed |
| sibling_count5+ | 0.00311 | 0.00787 | 0.3951 | -0.01232 | 0.01853 | fixed |
| sd_(Intercept).mother_pidlink | 0.0548 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.109 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.01294 | 0.07828 | 0.1654 | -0.1405 | 0.1664 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.001859 | 0.008409 | 0.2211 | -0.01462 | 0.01834 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001321 | 0.0002884 | -0.4581 | -0.0006975 | 0.0004332 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00000215 | 0.000003167 | 0.6788 | -0.000004058 | 0.000008357 | fixed |
| male | 0.003953 | 0.003932 | 1.005 | -0.003754 | 0.01166 | fixed |
| sibling_count3 | -0.003594 | 0.007444 | -0.4828 | -0.01818 | 0.011 | fixed |
| sibling_count4 | -0.002937 | 0.007673 | -0.3828 | -0.01798 | 0.0121 | fixed |
| sibling_count5 | -0.006432 | 0.008351 | -0.7703 | -0.0228 | 0.009935 | fixed |
| sibling_count5+ | 0.00298 | 0.008078 | 0.3689 | -0.01285 | 0.01881 | fixed |
| birth_order_nonlinear2 | 0.002136 | 0.005222 | 0.409 | -0.008099 | 0.01237 | fixed |
| birth_order_nonlinear3 | -0.001164 | 0.006104 | -0.1907 | -0.01313 | 0.0108 | fixed |
| birth_order_nonlinear4 | 0.0004516 | 0.007227 | 0.06249 | -0.01371 | 0.01462 | fixed |
| birth_order_nonlinear5 | 0.006838 | 0.008807 | 0.7765 | -0.01042 | 0.0241 | fixed |
| birth_order_nonlinear5+ | 0.01633 | 0.008275 | 1.974 | 0.0001131 | 0.03255 | fixed |
| sd_(Intercept).mother_pidlink | 0.05469 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1091 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.01009 | 0.07847 | 0.1286 | -0.1437 | 0.1639 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.002548 | 0.008429 | 0.3022 | -0.01397 | 0.01907 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001574 | 0.0002892 | -0.5441 | -0.0007243 | 0.0004095 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000002441 | 0.000003177 | 0.7684 | -0.000003785 | 0.000008668 | fixed |
| male | 0.003936 | 0.003938 | 0.9995 | -0.003783 | 0.01166 | fixed |
| count_birth_order2/2 | -0.007212 | 0.01106 | -0.6522 | -0.02889 | 0.01446 | fixed |
| count_birth_order1/3 | -0.008172 | 0.009511 | -0.8592 | -0.02681 | 0.01047 | fixed |
| count_birth_order2/3 | -0.009063 | 0.01034 | -0.8768 | -0.02932 | 0.0112 | fixed |
| count_birth_order3/3 | 0.001455 | 0.01135 | 0.1282 | -0.0208 | 0.02371 | fixed |
| count_birth_order1/4 | 0.0004717 | 0.01034 | 0.04564 | -0.01979 | 0.02073 | fixed |
| count_birth_order2/4 | -0.007483 | 0.01077 | -0.6945 | -0.0286 | 0.01363 | fixed |
| count_birth_order3/4 | -0.01528 | 0.01176 | -1.298 | -0.03833 | 0.007783 | fixed |
| count_birth_order4/4 | -0.001979 | 0.01256 | -0.1576 | -0.02659 | 0.02263 | fixed |
| count_birth_order1/5 | -0.01023 | 0.01238 | -0.8266 | -0.03449 | 0.01403 | fixed |
| count_birth_order2/5 | -0.007519 | 0.01284 | -0.5854 | -0.03269 | 0.01765 | fixed |
| count_birth_order3/5 | -0.0147 | 0.01307 | -1.125 | -0.04031 | 0.01091 | fixed |
| count_birth_order4/5 | 0.00125 | 0.01328 | 0.09417 | -0.02477 | 0.02728 | fixed |
| count_birth_order5/5 | -0.007193 | 0.01338 | -0.5377 | -0.03341 | 0.01902 | fixed |
| count_birth_order1/5+ | -0.0104 | 0.01119 | -0.9288 | -0.03233 | 0.01154 | fixed |
| count_birth_order2/5+ | 0.02034 | 0.01181 | 1.723 | -0.002802 | 0.04349 | fixed |
| count_birth_order3/5+ | -0.0001227 | 0.01137 | -0.01078 | -0.02242 | 0.02217 | fixed |
| count_birth_order4/5+ | -0.007947 | 0.01109 | -0.7164 | -0.02969 | 0.01379 | fixed |
| count_birth_order5/5+ | 0.009955 | 0.01172 | 0.8491 | -0.01302 | 0.03293 | fixed |
| count_birth_order5+/5+ | 0.01644 | 0.008933 | 1.84 | -0.001072 | 0.03395 | fixed |
| sd_(Intercept).mother_pidlink | 0.05419 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1092 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -5331 | -5262 | 2676 | -5353 | NA | NA | NA |
| 12 | -5332 | -5256 | 2678 | -5356 | 2.611 | 1 | 0.1061 |
| 16 | -5326 | -5226 | 2679 | -5358 | 2.522 | 4 | 0.6408 |
| 26 | -5318 | -5155 | 2685 | -5370 | 11.59 | 10 | 0.3135 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.001325 | 0.07952 | -0.01667 | -0.1572 | 0.1545 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.003218 | 0.008549 | 0.3765 | -0.01354 | 0.01997 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001742 | 0.0002935 | -0.5934 | -0.0007494 | 0.000401 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00000248 | 0.000003225 | 0.7689 | -0.000003842 | 0.000008801 | fixed |
| male | 0.003577 | 0.003991 | 0.8963 | -0.004245 | 0.0114 | fixed |
| sibling_count3 | -0.003884 | 0.006553 | -0.5927 | -0.01673 | 0.008959 | fixed |
| sibling_count4 | 0.002849 | 0.006893 | 0.4133 | -0.01066 | 0.01636 | fixed |
| sibling_count5 | -0.00005811 | 0.007916 | -0.007341 | -0.01557 | 0.01546 | fixed |
| sibling_count5+ | 0.01903 | 0.006764 | 2.814 | 0.005776 | 0.03229 | fixed |
| sd_(Intercept).mother_pidlink | 0.05496 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1093 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.0002167 | 0.07955 | -0.002724 | -0.1561 | 0.1557 | fixed |
| birth_order | 0.000822 | 0.001276 | 0.644 | -0.00168 | 0.003324 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.002991 | 0.008557 | 0.3496 | -0.01378 | 0.01976 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001681 | 0.0002936 | -0.5724 | -0.0007436 | 0.0004075 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00000245 | 0.000003226 | 0.7596 | -0.000003872 | 0.000008773 | fixed |
| male | 0.003571 | 0.003991 | 0.8946 | -0.004252 | 0.01139 | fixed |
| sibling_count3 | -0.004323 | 0.006588 | -0.6561 | -0.01724 | 0.00859 | fixed |
| sibling_count4 | 0.001934 | 0.007037 | 0.2748 | -0.01186 | 0.01573 | fixed |
| sibling_count5 | -0.001542 | 0.008244 | -0.187 | -0.0177 | 0.01462 | fixed |
| sibling_count5+ | 0.01604 | 0.008204 | 1.955 | -0.00003848 | 0.03212 | fixed |
| sd_(Intercept).mother_pidlink | 0.05492 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1093 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.004456 | 0.07962 | 0.05596 | -0.1516 | 0.1605 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.002493 | 0.008558 | 0.2913 | -0.01428 | 0.01927 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001531 | 0.0002937 | -0.5212 | -0.0007288 | 0.0004226 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000002327 | 0.000003228 | 0.721 | -0.000003999 | 0.000008653 | fixed |
| male | 0.00353 | 0.003992 | 0.8844 | -0.004294 | 0.01135 | fixed |
| sibling_count3 | -0.003619 | 0.006713 | -0.5391 | -0.01678 | 0.009538 | fixed |
| sibling_count4 | 0.001897 | 0.007268 | 0.261 | -0.01235 | 0.01614 | fixed |
| sibling_count5 | -0.0000944 | 0.008571 | -0.01101 | -0.01689 | 0.01671 | fixed |
| sibling_count5+ | 0.01416 | 0.008412 | 1.684 | -0.002323 | 0.03065 | fixed |
| birth_order_nonlinear2 | 0.003759 | 0.00514 | 0.7312 | -0.006316 | 0.01383 | fixed |
| birth_order_nonlinear3 | -0.001207 | 0.00609 | -0.1982 | -0.01314 | 0.01073 | fixed |
| birth_order_nonlinear4 | 0.006397 | 0.007642 | 0.837 | -0.008582 | 0.02138 | fixed |
| birth_order_nonlinear5 | -0.004586 | 0.009411 | -0.4873 | -0.02303 | 0.01386 | fixed |
| birth_order_nonlinear5+ | 0.01514 | 0.009452 | 1.602 | -0.003388 | 0.03366 | fixed |
| sd_(Intercept).mother_pidlink | 0.05481 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1094 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.001525 | 0.07984 | 0.0191 | -0.155 | 0.158 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.003193 | 0.008584 | 0.372 | -0.01363 | 0.02002 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001795 | 0.0002947 | -0.6092 | -0.0007572 | 0.0003981 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000002647 | 0.000003239 | 0.817 | -0.000003703 | 0.000008996 | fixed |
| male | 0.003806 | 0.003996 | 0.9523 | -0.004027 | 0.01164 | fixed |
| count_birth_order2/2 | -0.00583 | 0.009763 | -0.5971 | -0.02497 | 0.01331 | fixed |
| count_birth_order1/3 | -0.008914 | 0.008482 | -1.051 | -0.02554 | 0.00771 | fixed |
| count_birth_order2/3 | -0.006944 | 0.009415 | -0.7375 | -0.0254 | 0.01151 | fixed |
| count_birth_order3/3 | 0.001039 | 0.01007 | 0.1032 | -0.0187 | 0.02078 | fixed |
| count_birth_order1/4 | 0.005042 | 0.009935 | 0.5075 | -0.01443 | 0.02451 | fixed |
| count_birth_order2/4 | 0.001827 | 0.01037 | 0.1762 | -0.01849 | 0.02215 | fixed |
| count_birth_order3/4 | -0.01081 | 0.01086 | -0.9954 | -0.03209 | 0.01047 | fixed |
| count_birth_order4/4 | 0.005862 | 0.01171 | 0.5008 | -0.01708 | 0.0288 | fixed |
| count_birth_order1/5 | -0.005219 | 0.01298 | -0.4021 | -0.03066 | 0.02022 | fixed |
| count_birth_order2/5 | -0.001872 | 0.01453 | -0.1289 | -0.03035 | 0.0266 | fixed |
| count_birth_order3/5 | -0.009697 | 0.01392 | -0.6966 | -0.03698 | 0.01758 | fixed |
| count_birth_order4/5 | 0.01645 | 0.01343 | 1.225 | -0.00987 | 0.04277 | fixed |
| count_birth_order5/5 | -0.01244 | 0.01413 | -0.8801 | -0.04013 | 0.01526 | fixed |
| count_birth_order1/5+ | -0.003465 | 0.01264 | -0.2742 | -0.02823 | 0.0213 | fixed |
| count_birth_order2/5+ | 0.03849 | 0.01278 | 3.012 | 0.01345 | 0.06353 | fixed |
| count_birth_order3/5+ | 0.01002 | 0.01223 | 0.8194 | -0.01395 | 0.034 | fixed |
| count_birth_order4/5+ | 0.006257 | 0.01216 | 0.5146 | -0.01758 | 0.03009 | fixed |
| count_birth_order5/5+ | 0.009081 | 0.01151 | 0.7888 | -0.01348 | 0.03165 | fixed |
| count_birth_order5+/5+ | 0.02622 | 0.009074 | 2.889 | 0.008431 | 0.044 | fixed |
| sd_(Intercept).mother_pidlink | 0.05436 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1095 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -5181 | -5113 | 2602 | -5203 | NA | NA | NA |
| 12 | -5180 | -5105 | 2602 | -5204 | 0.4171 | 1 | 0.5184 |
| 16 | -5177 | -5077 | 2604 | -5209 | 4.736 | 4 | 0.3155 |
| 26 | -5171 | -5009 | 2611 | -5223 | 14.04 | 10 | 0.171 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = `Category_Casual worker not in agriculture`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2572 | 0.05886 | 4.37 | 0.1418 | 0.3725 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01623 | 0.00528 | -3.074 | -0.02658 | -0.005884 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0003827 | 0.0001483 | 2.581 | 0.00009208 | 0.0006733 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000002755 | 0.000001317 | -2.092 | -0.000005337 | -0.0000001736 | fixed |
| male | 0.06204 | 0.00543 | 11.43 | 0.0514 | 0.07269 | fixed |
| sibling_count3 | 0.002887 | 0.01133 | 0.2549 | -0.01932 | 0.02509 | fixed |
| sibling_count4 | -0.006908 | 0.01143 | -0.6044 | -0.02931 | 0.01549 | fixed |
| sibling_count5 | -0.001617 | 0.01191 | -0.1358 | -0.02496 | 0.02173 | fixed |
| sibling_count5+ | -0.007001 | 0.009233 | -0.7582 | -0.0251 | 0.0111 | fixed |
| sd_(Intercept).mother_pidlink | 0.09542 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2537 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2572 | 0.05886 | 4.37 | 0.1419 | 0.3726 | fixed |
| birth_order | -0.0001545 | 0.001106 | -0.1397 | -0.002322 | 0.002013 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01619 | 0.005289 | -3.061 | -0.02656 | -0.005824 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0003811 | 0.0001487 | 2.563 | 0.00008966 | 0.0006725 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000002741 | 0.000001321 | -2.075 | -0.000005331 | -0.0000001514 | fixed |
| male | 0.06205 | 0.00543 | 11.43 | 0.0514 | 0.07269 | fixed |
| sibling_count3 | 0.002928 | 0.01133 | 0.2583 | -0.01928 | 0.02514 | fixed |
| sibling_count4 | -0.006814 | 0.01145 | -0.5951 | -0.02925 | 0.01563 | fixed |
| sibling_count5 | -0.00145 | 0.01197 | -0.1212 | -0.02491 | 0.02201 | fixed |
| sibling_count5+ | -0.00646 | 0.01001 | -0.6453 | -0.02608 | 0.01316 | fixed |
| sd_(Intercept).mother_pidlink | 0.09546 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2537 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2574 | 0.05896 | 4.367 | 0.1419 | 0.373 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.0162 | 0.005294 | -3.06 | -0.02657 | -0.005822 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0003819 | 0.0001488 | 2.567 | 0.00009029 | 0.0006736 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000002754 | 0.000001322 | -2.083 | -0.000005345 | -0.0000001623 | fixed |
| male | 0.06205 | 0.005432 | 11.42 | 0.05141 | 0.0727 | fixed |
| sibling_count3 | 0.003057 | 0.0115 | 0.2658 | -0.01948 | 0.0256 | fixed |
| sibling_count4 | -0.006794 | 0.01176 | -0.578 | -0.02984 | 0.01625 | fixed |
| sibling_count5 | -0.0008552 | 0.01238 | -0.0691 | -0.02512 | 0.0234 | fixed |
| sibling_count5+ | -0.006345 | 0.01048 | -0.6053 | -0.02689 | 0.0142 | fixed |
| birth_order_nonlinear2 | -0.00146 | 0.007906 | -0.1847 | -0.01696 | 0.01404 | fixed |
| birth_order_nonlinear3 | -0.001161 | 0.009188 | -0.1263 | -0.01917 | 0.01685 | fixed |
| birth_order_nonlinear4 | -0.0003736 | 0.01032 | -0.03621 | -0.0206 | 0.01985 | fixed |
| birth_order_nonlinear5 | -0.004592 | 0.01161 | -0.3955 | -0.02734 | 0.01816 | fixed |
| birth_order_nonlinear5+ | -0.0009382 | 0.009655 | -0.09716 | -0.01986 | 0.01799 | fixed |
| sd_(Intercept).mother_pidlink | 0.09536 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2537 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2538 | 0.05915 | 4.291 | 0.1379 | 0.3697 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01604 | 0.005297 | -3.028 | -0.02642 | -0.00566 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.000377 | 0.0001488 | 2.533 | 0.00008526 | 0.0006687 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000002706 | 0.000001322 | -2.046 | -0.000005298 | -0.0000001144 | fixed |
| male | 0.06207 | 0.005433 | 11.42 | 0.05142 | 0.07272 | fixed |
| count_birth_order2/2 | 0.004305 | 0.0157 | 0.2742 | -0.02646 | 0.03507 | fixed |
| count_birth_order1/3 | 0.008432 | 0.01522 | 0.5541 | -0.02139 | 0.03826 | fixed |
| count_birth_order2/3 | 0.00825 | 0.01686 | 0.4892 | -0.0248 | 0.0413 | fixed |
| count_birth_order3/3 | -0.008015 | 0.01852 | -0.4328 | -0.04431 | 0.02828 | fixed |
| count_birth_order1/4 | -0.0248 | 0.01667 | -1.488 | -0.05747 | 0.007867 | fixed |
| count_birth_order2/4 | 0.007322 | 0.01787 | 0.4098 | -0.0277 | 0.04235 | fixed |
| count_birth_order3/4 | 0.01171 | 0.01905 | 0.6149 | -0.02562 | 0.04905 | fixed |
| count_birth_order4/4 | -0.009058 | 0.02023 | -0.4477 | -0.04872 | 0.0306 | fixed |
| count_birth_order1/5 | -0.01351 | 0.01892 | -0.7138 | -0.05059 | 0.02358 | fixed |
| count_birth_order2/5 | -0.01094 | 0.02006 | -0.5453 | -0.05026 | 0.02838 | fixed |
| count_birth_order3/5 | 0.02642 | 0.02112 | 1.251 | -0.01497 | 0.06782 | fixed |
| count_birth_order4/5 | 0.01116 | 0.0222 | 0.5028 | -0.03235 | 0.05466 | fixed |
| count_birth_order5/5 | -0.006309 | 0.02219 | -0.2843 | -0.04981 | 0.03719 | fixed |
| count_birth_order1/5+ | 0.01452 | 0.01457 | 0.9961 | -0.01405 | 0.04308 | fixed |
| count_birth_order2/5+ | -0.01502 | 0.01518 | -0.9897 | -0.04477 | 0.01473 | fixed |
| count_birth_order3/5+ | -0.01649 | 0.01495 | -1.103 | -0.04579 | 0.01281 | fixed |
| count_birth_order4/5+ | -0.005982 | 0.01468 | -0.4074 | -0.03476 | 0.0228 | fixed |
| count_birth_order5/5+ | -0.007781 | 0.01485 | -0.524 | -0.03688 | 0.02132 | fixed |
| count_birth_order5+/5+ | -0.005229 | 0.01203 | -0.4346 | -0.02881 | 0.01835 | fixed |
| sd_(Intercept).mother_pidlink | 0.09533 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2537 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 2203 | 2282 | -1090 | 2181 | NA | NA | NA |
| 12 | 2205 | 2291 | -1090 | 2181 | 0.01918 | 1 | 0.8899 |
| 16 | 2213 | 2328 | -1090 | 2181 | 0.1667 | 4 | 0.9967 |
| 26 | 2218 | 2406 | -1083 | 2166 | 14.27 | 10 | 0.1609 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5278 | 0.1723 | 3.064 | 0.1902 | 0.8654 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04411 | 0.0185 | -2.385 | -0.08037 | -0.007856 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00134 | 0.0006347 | 2.111 | 0.00009561 | 0.002583 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001395 | 0.000006968 | -2.001 | -0.0000276 | -0.0000002891 | fixed |
| male | 0.04766 | 0.008681 | 5.49 | 0.03064 | 0.06467 | fixed |
| sibling_count3 | -0.005651 | 0.01432 | -0.3946 | -0.03372 | 0.02242 | fixed |
| sibling_count4 | 0.009222 | 0.0148 | 0.6229 | -0.01979 | 0.03824 | fixed |
| sibling_count5 | -0.01576 | 0.01645 | -0.9578 | -0.04801 | 0.01649 | fixed |
| sibling_count5+ | 0.02188 | 0.01429 | 1.531 | -0.006124 | 0.04988 | fixed |
| sd_(Intercept).mother_pidlink | 0.08695 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2512 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5268 | 0.1723 | 3.058 | 0.1891 | 0.8645 | fixed |
| birth_order | -0.00116 | 0.002699 | -0.4297 | -0.006449 | 0.00413 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04386 | 0.01851 | -2.37 | -0.08014 | -0.007585 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001333 | 0.0006349 | 2.1 | 0.00008914 | 0.002578 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001393 | 0.000006969 | -1.999 | -0.00002759 | -0.0000002715 | fixed |
| male | 0.04769 | 0.008682 | 5.493 | 0.03067 | 0.06471 | fixed |
| sibling_count3 | -0.005053 | 0.01439 | -0.3512 | -0.03326 | 0.02315 | fixed |
| sibling_count4 | 0.01051 | 0.01511 | 0.6959 | -0.0191 | 0.04012 | fixed |
| sibling_count5 | -0.01363 | 0.01718 | -0.7934 | -0.04731 | 0.02005 | fixed |
| sibling_count5+ | 0.02605 | 0.01727 | 1.508 | -0.007805 | 0.05991 | fixed |
| sd_(Intercept).mother_pidlink | 0.08704 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2512 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5254 | 0.1725 | 3.046 | 0.1873 | 0.8635 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.0439 | 0.01852 | -2.37 | -0.0802 | -0.007599 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001338 | 0.0006353 | 2.106 | 0.00009249 | 0.002583 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001404 | 0.000006975 | -2.013 | -0.00002771 | -0.0000003718 | fixed |
| male | 0.04763 | 0.008685 | 5.484 | 0.03061 | 0.06465 | fixed |
| sibling_count3 | -0.001229 | 0.01468 | -0.08376 | -0.03 | 0.02754 | fixed |
| sibling_count4 | 0.01619 | 0.01565 | 1.035 | -0.01448 | 0.04687 | fixed |
| sibling_count5 | -0.00553 | 0.01801 | -0.3071 | -0.04082 | 0.02976 | fixed |
| sibling_count5+ | 0.03521 | 0.01774 | 1.985 | 0.0004435 | 0.06997 | fixed |
| birth_order_nonlinear2 | 0.0003386 | 0.01147 | 0.02952 | -0.02214 | 0.02282 | fixed |
| birth_order_nonlinear3 | -0.01783 | 0.01349 | -1.322 | -0.04427 | 0.008611 | fixed |
| birth_order_nonlinear4 | -0.01307 | 0.01643 | -0.7954 | -0.04528 | 0.01914 | fixed |
| birth_order_nonlinear5 | -0.01722 | 0.02021 | -0.8518 | -0.05683 | 0.02239 | fixed |
| birth_order_nonlinear5+ | -0.01704 | 0.02005 | -0.8501 | -0.05634 | 0.02225 | fixed |
| sd_(Intercept).mother_pidlink | 0.08715 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2512 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5537 | 0.1731 | 3.199 | 0.2145 | 0.8929 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04629 | 0.01858 | -2.491 | -0.08271 | -0.009864 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001425 | 0.0006377 | 2.234 | 0.000175 | 0.002675 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001505 | 0.000007003 | -2.15 | -0.00002878 | -0.00000133 | fixed |
| male | 0.04776 | 0.008695 | 5.492 | 0.03071 | 0.0648 | fixed |
| count_birth_order2/2 | -0.02316 | 0.02227 | -1.04 | -0.06681 | 0.02049 | fixed |
| count_birth_order1/3 | -0.01659 | 0.01882 | -0.8817 | -0.05348 | 0.02029 | fixed |
| count_birth_order2/3 | 0.002044 | 0.02091 | 0.09778 | -0.03893 | 0.04302 | fixed |
| count_birth_order3/3 | -0.0255 | 0.02262 | -1.127 | -0.06982 | 0.01883 | fixed |
| count_birth_order1/4 | -0.0171 | 0.02162 | -0.7912 | -0.05947 | 0.02527 | fixed |
| count_birth_order2/4 | 0.01951 | 0.02274 | 0.858 | -0.02506 | 0.06407 | fixed |
| count_birth_order3/4 | 0.004401 | 0.02385 | 0.1845 | -0.04235 | 0.05115 | fixed |
| count_birth_order4/4 | 0.006849 | 0.0253 | 0.2707 | -0.04274 | 0.05644 | fixed |
| count_birth_order1/5 | -0.0173 | 0.02837 | -0.6099 | -0.0729 | 0.0383 | fixed |
| count_birth_order2/5 | -0.008308 | 0.03089 | -0.269 | -0.06884 | 0.05223 | fixed |
| count_birth_order3/5 | -0.03295 | 0.02893 | -1.139 | -0.08966 | 0.02376 | fixed |
| count_birth_order4/5 | -0.03155 | 0.02815 | -1.121 | -0.08671 | 0.02362 | fixed |
| count_birth_order5/5 | -0.02164 | 0.02952 | -0.7332 | -0.07949 | 0.03621 | fixed |
| count_birth_order1/5+ | 0.07584 | 0.02698 | 2.811 | 0.02297 | 0.1287 | fixed |
| count_birth_order2/5+ | 0.01185 | 0.02723 | 0.4352 | -0.04152 | 0.06523 | fixed |
| count_birth_order3/5+ | -0.007979 | 0.02663 | -0.2996 | -0.06017 | 0.04421 | fixed |
| count_birth_order4/5+ | 0.007473 | 0.02587 | 0.2889 | -0.04322 | 0.05817 | fixed |
| count_birth_order5/5+ | 0.004793 | 0.02494 | 0.1922 | -0.04409 | 0.05368 | fixed |
| count_birth_order5+/5+ | 0.01042 | 0.01941 | 0.5368 | -0.02762 | 0.04846 | fixed |
| sd_(Intercept).mother_pidlink | 0.08705 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2512 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 715.1 | 783.9 | -346.6 | 693.1 | NA | NA | NA |
| 12 | 716.9 | 791.9 | -346.5 | 692.9 | 0.1845 | 1 | 0.6675 |
| 16 | 722.4 | 822.4 | -345.2 | 690.4 | 2.501 | 4 | 0.6444 |
| 26 | 731 | 893.5 | -339.5 | 679 | 11.45 | 10 | 0.3232 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5216 | 0.1714 | 3.044 | 0.1858 | 0.8575 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04348 | 0.01842 | -2.36 | -0.07958 | -0.007375 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001321 | 0.0006321 | 2.09 | 0.00008216 | 0.00256 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001375 | 0.000006941 | -1.98 | -0.00002735 | -0.0000001409 | fixed |
| male | 0.04835 | 0.008643 | 5.595 | 0.03141 | 0.0653 | fixed |
| sibling_count3 | -0.01324 | 0.01568 | -0.8443 | -0.04397 | 0.01749 | fixed |
| sibling_count4 | -0.005395 | 0.01581 | -0.3412 | -0.03638 | 0.02559 | fixed |
| sibling_count5 | 0.008151 | 0.01666 | 0.4892 | -0.02451 | 0.04081 | fixed |
| sibling_count5+ | 0.01342 | 0.01461 | 0.9192 | -0.0152 | 0.04205 | fixed |
| sd_(Intercept).mother_pidlink | 0.08703 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2509 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5211 | 0.1714 | 3.041 | 0.1852 | 0.857 | fixed |
| birth_order | -0.0006892 | 0.002377 | -0.2899 | -0.005349 | 0.00397 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04334 | 0.01843 | -2.352 | -0.07946 | -0.007223 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001318 | 0.0006322 | 2.084 | 0.00007869 | 0.002557 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001374 | 0.000006942 | -1.979 | -0.00002735 | -0.0000001349 | fixed |
| male | 0.04837 | 0.008644 | 5.596 | 0.03143 | 0.06531 | fixed |
| sibling_count3 | -0.01288 | 0.01573 | -0.8184 | -0.04371 | 0.01796 | fixed |
| sibling_count4 | -0.004677 | 0.016 | -0.2923 | -0.03605 | 0.02669 | fixed |
| sibling_count5 | 0.00933 | 0.01715 | 0.544 | -0.02429 | 0.04295 | fixed |
| sibling_count5+ | 0.01586 | 0.01685 | 0.9413 | -0.01716 | 0.04888 | fixed |
| sd_(Intercept).mother_pidlink | 0.0871 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2509 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5174 | 0.1715 | 3.017 | 0.1813 | 0.8536 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04304 | 0.01843 | -2.335 | -0.07916 | -0.006915 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001309 | 0.0006324 | 2.069 | 0.00006903 | 0.002548 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000137 | 0.000006945 | -1.973 | -0.00002731 | -0.00000008901 | fixed |
| male | 0.04827 | 0.008643 | 5.585 | 0.03133 | 0.06521 | fixed |
| sibling_count3 | -0.008033 | 0.01601 | -0.5018 | -0.03941 | 0.02334 | fixed |
| sibling_count4 | 0.004259 | 0.01648 | 0.2584 | -0.02804 | 0.03656 | fixed |
| sibling_count5 | 0.01848 | 0.01791 | 1.032 | -0.01662 | 0.05357 | fixed |
| sibling_count5+ | 0.02776 | 0.01734 | 1.602 | -0.006214 | 0.06174 | fixed |
| birth_order_nonlinear2 | 0.001952 | 0.0116 | 0.1683 | -0.02078 | 0.02469 | fixed |
| birth_order_nonlinear3 | -0.02108 | 0.01354 | -1.558 | -0.04761 | 0.005446 | fixed |
| birth_order_nonlinear4 | -0.0265 | 0.01601 | -1.655 | -0.05787 | 0.004873 | fixed |
| birth_order_nonlinear5 | -0.002944 | 0.0195 | -0.151 | -0.04116 | 0.03527 | fixed |
| birth_order_nonlinear5+ | -0.01788 | 0.01808 | -0.989 | -0.05332 | 0.01756 | fixed |
| sd_(Intercept).mother_pidlink | 0.08779 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2506 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5206 | 0.1719 | 3.028 | 0.1836 | 0.8575 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04292 | 0.01848 | -2.323 | -0.07913 | -0.006707 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00131 | 0.0006341 | 2.066 | 0.00006733 | 0.002553 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001377 | 0.000006966 | -1.977 | -0.00002742 | -0.000000116 | fixed |
| male | 0.04851 | 0.008658 | 5.603 | 0.03154 | 0.06548 | fixed |
| count_birth_order2/2 | -0.0166 | 0.02448 | -0.6779 | -0.06458 | 0.03138 | fixed |
| count_birth_order1/3 | -0.02012 | 0.02077 | -0.9688 | -0.06082 | 0.02058 | fixed |
| count_birth_order2/3 | -0.003152 | 0.0226 | -0.1394 | -0.04745 | 0.04115 | fixed |
| count_birth_order3/3 | -0.03641 | 0.02486 | -1.465 | -0.08513 | 0.01231 | fixed |
| count_birth_order1/4 | -0.02499 | 0.02258 | -1.107 | -0.06926 | 0.01927 | fixed |
| count_birth_order2/4 | 0.008599 | 0.02357 | 0.3648 | -0.03761 | 0.0548 | fixed |
| count_birth_order3/4 | -0.01663 | 0.02578 | -0.6451 | -0.06717 | 0.0339 | fixed |
| count_birth_order4/4 | -0.006556 | 0.02753 | -0.2381 | -0.06052 | 0.0474 | fixed |
| count_birth_order1/5 | 0.01083 | 0.02708 | 0.3998 | -0.04225 | 0.06391 | fixed |
| count_birth_order2/5 | 0.01599 | 0.02815 | 0.5683 | -0.03917 | 0.07116 | fixed |
| count_birth_order3/5 | 0.01195 | 0.02866 | 0.417 | -0.04422 | 0.06812 | fixed |
| count_birth_order4/5 | -0.01794 | 0.02915 | -0.6154 | -0.07506 | 0.03919 | fixed |
| count_birth_order5/5 | -0.01009 | 0.02936 | -0.3437 | -0.06764 | 0.04745 | fixed |
| count_birth_order1/5+ | 0.04959 | 0.02449 | 2.025 | 0.001597 | 0.09759 | fixed |
| count_birth_order2/5+ | 0.01055 | 0.0259 | 0.4072 | -0.04022 | 0.06132 | fixed |
| count_birth_order3/5+ | -0.01746 | 0.02495 | -0.6998 | -0.06636 | 0.03144 | fixed |
| count_birth_order4/5+ | -0.01776 | 0.02434 | -0.7295 | -0.06546 | 0.02995 | fixed |
| count_birth_order5/5+ | 0.03147 | 0.02575 | 1.222 | -0.019 | 0.08195 | fixed |
| count_birth_order5+/5+ | 0.00355 | 0.01941 | 0.1829 | -0.03448 | 0.04158 | fixed |
| sd_(Intercept).mother_pidlink | 0.08629 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2511 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 711.8 | 780.7 | -344.9 | 689.8 | NA | NA | NA |
| 12 | 713.7 | 788.8 | -344.9 | 689.7 | 0.08395 | 1 | 0.772 |
| 16 | 716.2 | 816.4 | -342.1 | 684.2 | 5.493 | 4 | 0.2404 |
| 26 | 726.6 | 889.3 | -337.3 | 674.6 | 9.669 | 10 | 0.47 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5159 | 0.1741 | 2.964 | 0.1747 | 0.857 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04311 | 0.01872 | -2.303 | -0.07981 | -0.006419 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001318 | 0.0006429 | 2.05 | 0.000058 | 0.002578 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001381 | 0.000007066 | -1.955 | -0.00002766 | 0.00000003501 | fixed |
| male | 0.04962 | 0.008764 | 5.662 | 0.03244 | 0.0668 | fixed |
| sibling_count3 | -0.007423 | 0.01403 | -0.5289 | -0.03493 | 0.02008 | fixed |
| sibling_count4 | 0.003436 | 0.01471 | 0.2335 | -0.0254 | 0.03227 | fixed |
| sibling_count5 | -0.02066 | 0.01679 | -1.23 | -0.05357 | 0.01225 | fixed |
| sibling_count5+ | 0.02131 | 0.01435 | 1.485 | -0.006809 | 0.04943 | fixed |
| sd_(Intercept).mother_pidlink | 0.08655 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2514 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5148 | 0.1741 | 2.956 | 0.1735 | 0.856 | fixed |
| birth_order | -0.0009926 | 0.002778 | -0.3573 | -0.006437 | 0.004452 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04287 | 0.01874 | -2.288 | -0.07959 | -0.006147 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001312 | 0.0006432 | 2.04 | 0.00005121 | 0.002572 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001379 | 0.000007067 | -1.951 | -0.00002764 | 0.00000006217 | fixed |
| male | 0.04963 | 0.008765 | 5.662 | 0.03245 | 0.0668 | fixed |
| sibling_count3 | -0.006901 | 0.01411 | -0.4891 | -0.03456 | 0.02076 | fixed |
| sibling_count4 | 0.004525 | 0.01502 | 0.3012 | -0.02492 | 0.03397 | fixed |
| sibling_count5 | -0.01889 | 0.01751 | -1.079 | -0.0532 | 0.01542 | fixed |
| sibling_count5+ | 0.02488 | 0.01747 | 1.424 | -0.009374 | 0.05913 | fixed |
| sd_(Intercept).mother_pidlink | 0.08661 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2514 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5132 | 0.1743 | 2.944 | 0.1715 | 0.8548 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04284 | 0.01875 | -2.285 | -0.07958 | -0.006096 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001315 | 0.0006437 | 2.044 | 0.00005383 | 0.002577 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001392 | 0.000007074 | -1.968 | -0.00002778 | -0.0000000542 | fixed |
| male | 0.04953 | 0.00877 | 5.648 | 0.03234 | 0.06672 | fixed |
| sibling_count3 | -0.004327 | 0.01441 | -0.3003 | -0.03257 | 0.02392 | fixed |
| sibling_count4 | 0.009017 | 0.01557 | 0.5791 | -0.0215 | 0.03954 | fixed |
| sibling_count5 | -0.01119 | 0.01828 | -0.6119 | -0.04702 | 0.02465 | fixed |
| sibling_count5+ | 0.0347 | 0.01797 | 1.931 | -0.0005219 | 0.06991 | fixed |
| birth_order_nonlinear2 | -0.001036 | 0.01143 | -0.09066 | -0.02344 | 0.02136 | fixed |
| birth_order_nonlinear3 | -0.01195 | 0.01352 | -0.8841 | -0.03845 | 0.01454 | fixed |
| birth_order_nonlinear4 | -0.01326 | 0.01694 | -0.7827 | -0.04646 | 0.01994 | fixed |
| birth_order_nonlinear5 | -0.02167 | 0.02087 | -1.038 | -0.06258 | 0.01924 | fixed |
| birth_order_nonlinear5+ | -0.01784 | 0.02069 | -0.8624 | -0.05839 | 0.02271 | fixed |
| sd_(Intercept).mother_pidlink | 0.08642 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2516 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5353 | 0.1748 | 3.062 | 0.1927 | 0.8779 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04495 | 0.0188 | -2.391 | -0.0818 | -0.008104 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001394 | 0.0006457 | 2.158 | 0.0001281 | 0.002659 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001485 | 0.000007099 | -2.092 | -0.00002876 | -0.0000009356 | fixed |
| male | 0.04938 | 0.00878 | 5.625 | 0.03218 | 0.06659 | fixed |
| count_birth_order2/2 | -0.0126 | 0.02165 | -0.5819 | -0.05504 | 0.02984 | fixed |
| count_birth_order1/3 | -0.0158 | 0.01851 | -0.8535 | -0.05207 | 0.02048 | fixed |
| count_birth_order2/3 | 0.0005413 | 0.02059 | 0.02629 | -0.03981 | 0.04089 | fixed |
| count_birth_order3/3 | -0.01806 | 0.02204 | -0.8195 | -0.06126 | 0.02514 | fixed |
| count_birth_order1/4 | -0.01388 | 0.02171 | -0.6392 | -0.05642 | 0.02867 | fixed |
| count_birth_order2/4 | 0.01046 | 0.02269 | 0.461 | -0.03401 | 0.05493 | fixed |
| count_birth_order3/4 | 0.00654 | 0.02379 | 0.275 | -0.04008 | 0.05316 | fixed |
| count_birth_order4/4 | -0.001575 | 0.02566 | -0.06138 | -0.05186 | 0.04871 | fixed |
| count_birth_order1/5 | -0.02303 | 0.0284 | -0.811 | -0.07869 | 0.03263 | fixed |
| count_birth_order2/5 | 0.007691 | 0.03189 | 0.2412 | -0.0548 | 0.07019 | fixed |
| count_birth_order3/5 | -0.03383 | 0.03054 | -1.108 | -0.09369 | 0.02603 | fixed |
| count_birth_order4/5 | -0.04271 | 0.02946 | -1.45 | -0.1004 | 0.01502 | fixed |
| count_birth_order5/5 | -0.02514 | 0.03101 | -0.8108 | -0.08592 | 0.03564 | fixed |
| count_birth_order1/5+ | 0.08574 | 0.02768 | 3.098 | 0.0315 | 0.14 | fixed |
| count_birth_order2/5+ | -0.0053 | 0.02803 | -0.189 | -0.06025 | 0.04965 | fixed |
| count_birth_order3/5+ | 0.003049 | 0.02684 | 0.1136 | -0.04956 | 0.05566 | fixed |
| count_birth_order4/5+ | 0.02215 | 0.02671 | 0.8294 | -0.0302 | 0.0745 | fixed |
| count_birth_order5/5+ | 0.00261 | 0.02527 | 0.1033 | -0.04692 | 0.05214 | fixed |
| count_birth_order5+/5+ | 0.01287 | 0.01968 | 0.6538 | -0.0257 | 0.05144 | fixed |
| sd_(Intercept).mother_pidlink | 0.08667 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2514 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 705.5 | 774 | -341.7 | 683.5 | NA | NA | NA |
| 12 | 707.4 | 782.2 | -341.7 | 683.4 | 0.1277 | 1 | 0.7209 |
| 16 | 713.6 | 813.3 | -340.8 | 681.6 | 1.778 | 4 | 0.7765 |
| 26 | 721 | 883.1 | -334.5 | 669 | 12.58 | 10 | 0.2478 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = `Category_Government worker`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.1944 | 0.05324 | -3.651 | -0.2987 | -0.09004 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01928 | 0.004779 | 4.034 | 0.009912 | 0.02865 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0004177 | 0.0001344 | -3.108 | -0.0006812 | -0.0001543 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000002971 | 0.000001196 | 2.484 | 0.0000006272 | 0.000005316 | fixed |
| male | -0.02151 | 0.004853 | -4.432 | -0.03102 | -0.012 | fixed |
| sibling_count3 | 0.008502 | 0.01049 | 0.8108 | -0.01205 | 0.02905 | fixed |
| sibling_count4 | 0.01057 | 0.0106 | 0.9964 | -0.01022 | 0.03135 | fixed |
| sibling_count5 | 0.01661 | 0.01108 | 1.498 | -0.005117 | 0.03833 | fixed |
| sibling_count5+ | -0.009424 | 0.008552 | -1.102 | -0.02619 | 0.007337 | fixed |
| sd_(Intercept).mother_pidlink | 0.1135 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2183 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.1943 | 0.05324 | -3.649 | -0.2986 | -0.08993 | fixed |
| birth_order | -0.0002719 | 0.001006 | -0.2703 | -0.002244 | 0.0017 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01936 | 0.004788 | 4.043 | 0.009972 | 0.02874 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0004207 | 0.0001349 | -3.119 | -0.000685 | -0.0001563 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000002999 | 0.0000012 | 2.498 | 0.000000646 | 0.000005352 | fixed |
| male | -0.02151 | 0.004854 | -4.431 | -0.03102 | -0.01199 | fixed |
| sibling_count3 | 0.008566 | 0.01049 | 0.8168 | -0.01199 | 0.02912 | fixed |
| sibling_count4 | 0.01072 | 0.01062 | 1.009 | -0.01009 | 0.03153 | fixed |
| sibling_count5 | 0.01689 | 0.01113 | 1.517 | -0.004931 | 0.0387 | fixed |
| sibling_count5+ | -0.008494 | 0.00922 | -0.9212 | -0.02656 | 0.009577 | fixed |
| sd_(Intercept).mother_pidlink | 0.1135 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2183 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.1934 | 0.0533 | -3.628 | -0.2979 | -0.08892 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.01971 | 0.004791 | 4.115 | 0.01032 | 0.0291 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0004282 | 0.0001349 | -3.175 | -0.0006926 | -0.0001639 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000003015 | 0.000001201 | 2.511 | 0.0000006618 | 0.000005368 | fixed |
| male | -0.02147 | 0.004854 | -4.424 | -0.03098 | -0.01196 | fixed |
| sibling_count3 | 0.01191 | 0.01062 | 1.121 | -0.008906 | 0.03273 | fixed |
| sibling_count4 | 0.01411 | 0.01086 | 1.299 | -0.007181 | 0.03541 | fixed |
| sibling_count5 | 0.02163 | 0.01146 | 1.888 | -0.0008248 | 0.04409 | fixed |
| sibling_count5+ | -0.002547 | 0.009608 | -0.2651 | -0.02138 | 0.01628 | fixed |
| birth_order_nonlinear2 | -0.01229 | 0.007011 | -1.753 | -0.02603 | 0.001451 | fixed |
| birth_order_nonlinear3 | -0.01874 | 0.008133 | -2.304 | -0.03468 | -0.002798 | fixed |
| birth_order_nonlinear4 | -0.00766 | 0.009138 | -0.8382 | -0.02557 | 0.01025 | fixed |
| birth_order_nonlinear5 | -0.01681 | 0.01028 | -1.634 | -0.03696 | 0.003347 | fixed |
| birth_order_nonlinear5+ | -0.0144 | 0.008664 | -1.662 | -0.03138 | 0.002579 | fixed |
| sd_(Intercept).mother_pidlink | 0.1133 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2184 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.1926 | 0.05348 | -3.602 | -0.2975 | -0.08783 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0199 | 0.004794 | 4.151 | 0.0105 | 0.0293 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0004295 | 0.000135 | -3.182 | -0.000694 | -0.000165 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000002987 | 0.000001201 | 2.486 | 0.0000006324 | 0.000005341 | fixed |
| male | -0.02117 | 0.004856 | -4.36 | -0.03069 | -0.01165 | fixed |
| count_birth_order2/2 | -0.0235 | 0.01393 | -1.687 | -0.0508 | 0.003795 | fixed |
| count_birth_order1/3 | 0.02031 | 0.01377 | 1.475 | -0.00668 | 0.04729 | fixed |
| count_birth_order2/3 | -0.01708 | 0.01523 | -1.121 | -0.04693 | 0.01278 | fixed |
| count_birth_order3/3 | -0.01838 | 0.0167 | -1.101 | -0.05112 | 0.01435 | fixed |
| count_birth_order1/4 | 0.009319 | 0.01506 | 0.6189 | -0.02019 | 0.03883 | fixed |
| count_birth_order2/4 | 0.01105 | 0.01613 | 0.685 | -0.02056 | 0.04265 | fixed |
| count_birth_order3/4 | -0.0106 | 0.01717 | -0.6175 | -0.04426 | 0.02305 | fixed |
| count_birth_order4/4 | -0.01459 | 0.01822 | -0.8008 | -0.05031 | 0.02113 | fixed |
| count_birth_order1/5 | 0.01084 | 0.01706 | 0.6352 | -0.0226 | 0.04428 | fixed |
| count_birth_order2/5 | -0.002587 | 0.01808 | -0.1431 | -0.03802 | 0.03285 | fixed |
| count_birth_order3/5 | 0.01388 | 0.01901 | 0.7301 | -0.02338 | 0.05115 | fixed |
| count_birth_order4/5 | 0.006791 | 0.01995 | 0.3404 | -0.03231 | 0.04589 | fixed |
| count_birth_order5/5 | 0.006184 | 0.01996 | 0.3098 | -0.03294 | 0.04531 | fixed |
| count_birth_order1/5+ | -0.01924 | 0.01312 | -1.466 | -0.04496 | 0.006483 | fixed |
| count_birth_order2/5+ | -0.01011 | 0.01365 | -0.7407 | -0.03687 | 0.01664 | fixed |
| count_birth_order3/5+ | -0.027 | 0.01345 | -2.008 | -0.05336 | -0.0006427 | fixed |
| count_birth_order4/5+ | -0.007687 | 0.01322 | -0.5815 | -0.0336 | 0.01822 | fixed |
| count_birth_order5/5+ | -0.02553 | 0.01336 | -1.911 | -0.05171 | 0.000652 | fixed |
| count_birth_order5+/5+ | -0.02128 | 0.01098 | -1.938 | -0.0428 | 0.0002367 | fixed |
| sd_(Intercept).mother_pidlink | 0.1134 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2183 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 72.34 | 151.8 | -25.17 | 50.34 | NA | NA | NA |
| 12 | 74.27 | 160.9 | -25.13 | 50.27 | 0.0738 | 1 | 0.7859 |
| 16 | 75.28 | 190.8 | -21.64 | 43.28 | 6.987 | 4 | 0.1366 |
| 26 | 84.51 | 272.2 | -16.26 | 32.51 | 10.77 | 10 | 0.3758 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.867 | 0.1698 | -5.107 | -1.2 | -0.5343 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09225 | 0.01822 | 5.062 | 0.05653 | 0.128 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002883 | 0.000625 | -4.613 | -0.004108 | -0.001658 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003017 | 0.000006861 | 4.397 | 0.00001672 | 0.00004362 | fixed |
| male | -0.02578 | 0.008528 | -3.023 | -0.0425 | -0.009067 | fixed |
| sibling_count3 | 0.007785 | 0.01443 | 0.5395 | -0.0205 | 0.03607 | fixed |
| sibling_count4 | 0.004312 | 0.01497 | 0.2881 | -0.02502 | 0.03365 | fixed |
| sibling_count5 | 0.003921 | 0.01672 | 0.2346 | -0.02884 | 0.03668 | fixed |
| sibling_count5+ | -0.0358 | 0.01452 | -2.465 | -0.06425 | -0.007338 | fixed |
| sd_(Intercept).mother_pidlink | 0.1191 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2355 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.871 | 0.1698 | -5.13 | -1.204 | -0.5382 | fixed |
| birth_order | -0.003387 | 0.002677 | -1.265 | -0.008633 | 0.00186 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09312 | 0.01824 | 5.106 | 0.05738 | 0.1289 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002906 | 0.0006253 | -4.648 | -0.004131 | -0.00168 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003026 | 0.000006861 | 4.411 | 0.00001681 | 0.00004371 | fixed |
| male | -0.02566 | 0.008528 | -3.009 | -0.04238 | -0.00895 | fixed |
| sibling_count3 | 0.009541 | 0.01449 | 0.6583 | -0.01887 | 0.03795 | fixed |
| sibling_count4 | 0.008137 | 0.01526 | 0.5331 | -0.02178 | 0.03805 | fixed |
| sibling_count5 | 0.0102 | 0.01743 | 0.5852 | -0.02396 | 0.04436 | fixed |
| sibling_count5+ | -0.02346 | 0.01749 | -1.341 | -0.05774 | 0.01082 | fixed |
| sd_(Intercept).mother_pidlink | 0.1187 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2356 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8585 | 0.17 | -5.05 | -1.192 | -0.5253 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09185 | 0.01824 | 5.034 | 0.05609 | 0.1276 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002859 | 0.0006256 | -4.571 | -0.004086 | -0.001633 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002975 | 0.000006867 | 4.332 | 0.00001629 | 0.00004321 | fixed |
| male | -0.02605 | 0.00853 | -3.054 | -0.04277 | -0.009332 | fixed |
| sibling_count3 | 0.01138 | 0.01476 | 0.7712 | -0.01755 | 0.04031 | fixed |
| sibling_count4 | 0.007978 | 0.01577 | 0.506 | -0.02293 | 0.03888 | fixed |
| sibling_count5 | 0.01 | 0.01819 | 0.5499 | -0.02565 | 0.04566 | fixed |
| sibling_count5+ | -0.02489 | 0.01792 | -1.389 | -0.06001 | 0.01024 | fixed |
| birth_order_nonlinear2 | -0.01938 | 0.01113 | -1.741 | -0.04121 | 0.002441 | fixed |
| birth_order_nonlinear3 | -0.01584 | 0.01312 | -1.207 | -0.04154 | 0.009869 | fixed |
| birth_order_nonlinear4 | -0.004245 | 0.016 | -0.2654 | -0.0356 | 0.02711 | fixed |
| birth_order_nonlinear5 | -0.02336 | 0.01968 | -1.187 | -0.06192 | 0.01521 | fixed |
| birth_order_nonlinear5+ | -0.02327 | 0.01977 | -1.177 | -0.06203 | 0.01548 | fixed |
| sd_(Intercept).mother_pidlink | 0.1191 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2355 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.837 | 0.1707 | -4.905 | -1.172 | -0.5026 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08981 | 0.01832 | 4.903 | 0.05391 | 0.1257 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00279 | 0.0006283 | -4.441 | -0.004022 | -0.001559 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002901 | 0.000006898 | 4.205 | 0.00001549 | 0.00004253 | fixed |
| male | -0.02647 | 0.008544 | -3.098 | -0.04321 | -0.00972 | fixed |
| count_birth_order2/2 | -0.02663 | 0.02168 | -1.228 | -0.06913 | 0.01586 | fixed |
| count_birth_order1/3 | 0.0166 | 0.01863 | 0.8912 | -0.01991 | 0.05311 | fixed |
| count_birth_order2/3 | -0.01654 | 0.02066 | -0.8007 | -0.05702 | 0.02395 | fixed |
| count_birth_order3/3 | -0.01347 | 0.02232 | -0.6033 | -0.05721 | 0.03028 | fixed |
| count_birth_order1/4 | -0.01372 | 0.02137 | -0.6419 | -0.0556 | 0.02817 | fixed |
| count_birth_order2/4 | 0.01028 | 0.02244 | 0.4582 | -0.0337 | 0.05427 | fixed |
| count_birth_order3/4 | 0.003243 | 0.02351 | 0.1379 | -0.04284 | 0.04932 | fixed |
| count_birth_order4/4 | -0.01605 | 0.02493 | -0.644 | -0.06492 | 0.03281 | fixed |
| count_birth_order1/5 | 0.01175 | 0.02799 | 0.4196 | -0.04312 | 0.06661 | fixed |
| count_birth_order2/5 | -0.03345 | 0.03039 | -1.101 | -0.09303 | 0.02612 | fixed |
| count_birth_order3/5 | -0.03181 | 0.02849 | -1.116 | -0.08764 | 0.02403 | fixed |
| count_birth_order4/5 | 0.02514 | 0.02771 | 0.9072 | -0.02917 | 0.07944 | fixed |
| count_birth_order5/5 | -0.000456 | 0.02904 | -0.0157 | -0.05738 | 0.05647 | fixed |
| count_birth_order1/5+ | -0.02476 | 0.0266 | -0.9311 | -0.07689 | 0.02737 | fixed |
| count_birth_order2/5+ | -0.04955 | 0.0268 | -1.849 | -0.1021 | 0.002986 | fixed |
| count_birth_order3/5+ | -0.03274 | 0.0262 | -1.25 | -0.08409 | 0.0186 | fixed |
| count_birth_order4/5+ | -0.03021 | 0.02543 | -1.188 | -0.08006 | 0.01963 | fixed |
| count_birth_order5/5+ | -0.06004 | 0.02453 | -2.447 | -0.1081 | -0.01195 | fixed |
| count_birth_order5+/5+ | -0.05057 | 0.01932 | -2.617 | -0.08844 | -0.0127 | fixed |
| sd_(Intercept).mother_pidlink | 0.1189 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2356 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 613.9 | 682.6 | -295.9 | 591.9 | NA | NA | NA |
| 12 | 614.3 | 689.3 | -295.1 | 590.3 | 1.606 | 1 | 0.205 |
| 16 | 619.3 | 719.3 | -293.7 | 587.3 | 2.942 | 4 | 0.5676 |
| 26 | 630.8 | 793.3 | -289.4 | 578.8 | 8.559 | 10 | 0.5744 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8577 | 0.1687 | -5.085 | -1.188 | -0.5271 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09078 | 0.01812 | 5.01 | 0.05527 | 0.1263 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002845 | 0.0006216 | -4.577 | -0.004064 | -0.001627 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002981 | 0.000006826 | 4.367 | 0.00001643 | 0.00004319 | fixed |
| male | -0.02579 | 0.008479 | -3.041 | -0.04241 | -0.009168 | fixed |
| sibling_count3 | 0.01011 | 0.01575 | 0.6416 | -0.02077 | 0.04098 | fixed |
| sibling_count4 | 0.02064 | 0.01592 | 1.297 | -0.01055 | 0.05184 | fixed |
| sibling_count5 | 0.01602 | 0.01683 | 0.9516 | -0.01697 | 0.049 | fixed |
| sibling_count5+ | -0.01717 | 0.01473 | -1.166 | -0.04605 | 0.0117 | fixed |
| sd_(Intercept).mother_pidlink | 0.1183 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2351 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8617 | 0.1686 | -5.11 | -1.192 | -0.5311 | fixed |
| birth_order | -0.004012 | 0.00236 | -1.7 | -0.008638 | 0.0006143 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09173 | 0.01813 | 5.061 | 0.0562 | 0.1273 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002869 | 0.0006217 | -4.615 | -0.004088 | -0.001651 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002989 | 0.000006824 | 4.379 | 0.00001651 | 0.00004326 | fixed |
| male | -0.02568 | 0.008478 | -3.029 | -0.04229 | -0.00906 | fixed |
| sibling_count3 | 0.01227 | 0.0158 | 0.7764 | -0.0187 | 0.04323 | fixed |
| sibling_count4 | 0.0249 | 0.01611 | 1.546 | -0.00667 | 0.05646 | fixed |
| sibling_count5 | 0.02296 | 0.01731 | 1.327 | -0.01097 | 0.05689 | fixed |
| sibling_count5+ | -0.002852 | 0.01697 | -0.168 | -0.03611 | 0.03041 | fixed |
| sd_(Intercept).mother_pidlink | 0.1179 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2352 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.844 | 0.1687 | -5.003 | -1.175 | -0.5133 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08976 | 0.01812 | 4.953 | 0.05424 | 0.1253 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0028 | 0.0006216 | -4.503 | -0.004018 | -0.001581 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002914 | 0.000006826 | 4.268 | 0.00001576 | 0.00004251 | fixed |
| male | -0.02612 | 0.008475 | -3.082 | -0.04273 | -0.009508 | fixed |
| sibling_count3 | 0.01501 | 0.01605 | 0.9355 | -0.01644 | 0.04646 | fixed |
| sibling_count4 | 0.02489 | 0.01654 | 1.505 | -0.007523 | 0.05731 | fixed |
| sibling_count5 | 0.02825 | 0.018 | 1.569 | -0.007033 | 0.06353 | fixed |
| sibling_count5+ | -0.003534 | 0.01741 | -0.203 | -0.03766 | 0.03059 | fixed |
| birth_order_nonlinear2 | -0.0175 | 0.01125 | -1.555 | -0.03955 | 0.004559 | fixed |
| birth_order_nonlinear3 | -0.02054 | 0.01315 | -1.561 | -0.04632 | 0.005246 | fixed |
| birth_order_nonlinear4 | -0.001737 | 0.01557 | -0.1115 | -0.03226 | 0.02879 | fixed |
| birth_order_nonlinear5 | -0.05317 | 0.01898 | -2.802 | -0.09037 | -0.01598 | fixed |
| birth_order_nonlinear5+ | -0.02094 | 0.01784 | -1.174 | -0.0559 | 0.01402 | fixed |
| sd_(Intercept).mother_pidlink | 0.1181 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.235 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8285 | 0.1689 | -4.904 | -1.16 | -0.4974 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0882 | 0.01815 | 4.86 | 0.05263 | 0.1238 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002742 | 0.0006227 | -4.404 | -0.003963 | -0.001522 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002847 | 0.000006839 | 4.163 | 0.00001507 | 0.00004188 | fixed |
| male | -0.0269 | 0.008477 | -3.173 | -0.04351 | -0.01028 | fixed |
| count_birth_order2/2 | -0.0224 | 0.0238 | -0.9412 | -0.06904 | 0.02424 | fixed |
| count_birth_order1/3 | 0.02072 | 0.02048 | 1.012 | -0.01943 | 0.06087 | fixed |
| count_birth_order2/3 | -0.01094 | 0.02226 | -0.4914 | -0.05457 | 0.03269 | fixed |
| count_birth_order3/3 | -0.01167 | 0.02445 | -0.4772 | -0.05958 | 0.03625 | fixed |
| count_birth_order1/4 | 0.01157 | 0.02226 | 0.5198 | -0.03206 | 0.0552 | fixed |
| count_birth_order2/4 | 0.0485 | 0.0232 | 2.09 | 0.003027 | 0.09397 | fixed |
| count_birth_order3/4 | -0.008379 | 0.02533 | -0.3308 | -0.05803 | 0.04127 | fixed |
| count_birth_order4/4 | -0.0125 | 0.02703 | -0.4624 | -0.06548 | 0.04048 | fixed |
| count_birth_order1/5 | 0.03036 | 0.02665 | 1.139 | -0.02187 | 0.08259 | fixed |
| count_birth_order2/5 | -0.02963 | 0.02765 | -1.071 | -0.08383 | 0.02457 | fixed |
| count_birth_order3/5 | -0.007984 | 0.02813 | -0.2838 | -0.06312 | 0.04715 | fixed |
| count_birth_order4/5 | 0.07203 | 0.02859 | 2.52 | 0.016 | 0.1281 | fixed |
| count_birth_order5/5 | -0.01908 | 0.0288 | -0.6625 | -0.07552 | 0.03736 | fixed |
| count_birth_order1/5+ | -0.007641 | 0.0241 | -0.317 | -0.05488 | 0.0396 | fixed |
| count_birth_order2/5+ | -0.03434 | 0.02542 | -1.351 | -0.08417 | 0.01549 | fixed |
| count_birth_order3/5+ | -0.002912 | 0.02449 | -0.1189 | -0.05091 | 0.04509 | fixed |
| count_birth_order4/5+ | -0.01136 | 0.02388 | -0.4756 | -0.05817 | 0.03545 | fixed |
| count_birth_order5/5+ | -0.0629 | 0.02524 | -2.492 | -0.1124 | -0.01343 | fixed |
| count_birth_order5+/5+ | -0.02624 | 0.01925 | -1.364 | -0.06396 | 0.01148 | fixed |
| sd_(Intercept).mother_pidlink | 0.1185 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2345 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 598.1 | 666.9 | -288 | 576.1 | NA | NA | NA |
| 12 | 597.2 | 672.3 | -286.6 | 573.2 | 2.897 | 1 | 0.08874 |
| 16 | 597.7 | 697.8 | -282.8 | 565.7 | 7.516 | 4 | 0.111 |
| 26 | 599.1 | 761.8 | -273.5 | 547.1 | 18.6 | 10 | 0.04565 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8904 | 0.1716 | -5.188 | -1.227 | -0.554 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09498 | 0.01845 | 5.148 | 0.05882 | 0.1311 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002992 | 0.0006334 | -4.723 | -0.004233 | -0.00175 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003151 | 0.000006961 | 4.527 | 0.00001787 | 0.00004515 | fixed |
| male | -0.02612 | 0.008613 | -3.032 | -0.043 | -0.009236 | fixed |
| sibling_count3 | 0.005929 | 0.01414 | 0.4193 | -0.02178 | 0.03364 | fixed |
| sibling_count4 | 0.01116 | 0.01487 | 0.7506 | -0.01799 | 0.04031 | fixed |
| sibling_count5 | 0.009306 | 0.01708 | 0.5449 | -0.02417 | 0.04278 | fixed |
| sibling_count5+ | -0.03426 | 0.01459 | -2.347 | -0.06286 | -0.005654 | fixed |
| sd_(Intercept).mother_pidlink | 0.1183 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.236 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8946 | 0.1717 | -5.211 | -1.231 | -0.5582 | fixed |
| birth_order | -0.003066 | 0.002754 | -1.113 | -0.008464 | 0.002332 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09584 | 0.01847 | 5.19 | 0.05965 | 0.132 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.003015 | 0.0006337 | -4.757 | -0.004257 | -0.001773 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003162 | 0.000006962 | 4.543 | 0.00001798 | 0.00004527 | fixed |
| male | -0.02608 | 0.008613 | -3.028 | -0.04297 | -0.009201 | fixed |
| sibling_count3 | 0.007558 | 0.01421 | 0.5318 | -0.0203 | 0.03541 | fixed |
| sibling_count4 | 0.01457 | 0.01518 | 0.9599 | -0.01518 | 0.04432 | fixed |
| sibling_count5 | 0.01484 | 0.01778 | 0.8345 | -0.02001 | 0.04969 | fixed |
| sibling_count5+ | -0.02312 | 0.0177 | -1.306 | -0.0578 | 0.01157 | fixed |
| sd_(Intercept).mother_pidlink | 0.118 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2361 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8848 | 0.1719 | -5.148 | -1.222 | -0.548 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0948 | 0.01847 | 5.132 | 0.05859 | 0.131 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002977 | 0.0006341 | -4.695 | -0.00422 | -0.001734 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003121 | 0.000006968 | 4.48 | 0.00001756 | 0.00004487 | fixed |
| male | -0.0264 | 0.008617 | -3.063 | -0.04329 | -0.009507 | fixed |
| sibling_count3 | 0.009706 | 0.01449 | 0.6698 | -0.01869 | 0.0381 | fixed |
| sibling_count4 | 0.01476 | 0.01569 | 0.9406 | -0.01599 | 0.0455 | fixed |
| sibling_count5 | 0.01424 | 0.0185 | 0.7696 | -0.02202 | 0.0505 | fixed |
| sibling_count5+ | -0.02438 | 0.01816 | -1.343 | -0.05996 | 0.01121 | fixed |
| birth_order_nonlinear2 | -0.01562 | 0.0111 | -1.408 | -0.03737 | 0.006128 | fixed |
| birth_order_nonlinear3 | -0.01657 | 0.01315 | -1.26 | -0.04234 | 0.009199 | fixed |
| birth_order_nonlinear4 | -0.002065 | 0.0165 | -0.1252 | -0.0344 | 0.03027 | fixed |
| birth_order_nonlinear5 | -0.0181 | 0.02032 | -0.891 | -0.05792 | 0.02172 | fixed |
| birth_order_nonlinear5+ | -0.02136 | 0.0204 | -1.047 | -0.06135 | 0.01863 | fixed |
| sd_(Intercept).mother_pidlink | 0.1181 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2362 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.8625 | 0.1725 | -5 | -1.201 | -0.5244 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.09284 | 0.01855 | 5.006 | 0.05649 | 0.1292 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002912 | 0.0006367 | -4.574 | -0.00416 | -0.001665 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003055 | 0.000006999 | 4.365 | 0.00001684 | 0.00004427 | fixed |
| male | -0.02659 | 0.008634 | -3.08 | -0.04351 | -0.00967 | fixed |
| count_birth_order2/2 | -0.02698 | 0.02109 | -1.28 | -0.06831 | 0.01435 | fixed |
| count_birth_order1/3 | 0.01649 | 0.01833 | 0.8995 | -0.01944 | 0.05241 | fixed |
| count_birth_order2/3 | -0.01704 | 0.02034 | -0.8376 | -0.05691 | 0.02283 | fixed |
| count_birth_order3/3 | -0.02125 | 0.02176 | -0.9768 | -0.06389 | 0.02139 | fixed |
| count_birth_order1/4 | -0.01368 | 0.02147 | -0.6371 | -0.05575 | 0.0284 | fixed |
| count_birth_order2/4 | 0.0192 | 0.0224 | 0.857 | -0.02471 | 0.0631 | fixed |
| count_birth_order3/4 | 0.004533 | 0.02346 | 0.1932 | -0.04145 | 0.05051 | fixed |
| count_birth_order4/4 | 0.003269 | 0.02529 | 0.1293 | -0.0463 | 0.05284 | fixed |
| count_birth_order1/5 | 0.00178 | 0.02805 | 0.06347 | -0.05319 | 0.05675 | fixed |
| count_birth_order2/5 | -0.01452 | 0.03139 | -0.4625 | -0.07603 | 0.047 | fixed |
| count_birth_order3/5 | -0.009643 | 0.03007 | -0.3207 | -0.06858 | 0.0493 | fixed |
| count_birth_order4/5 | 0.02184 | 0.02901 | 0.753 | -0.03502 | 0.0787 | fixed |
| count_birth_order5/5 | 0.0006849 | 0.03053 | 0.02243 | -0.05915 | 0.06052 | fixed |
| count_birth_order1/5+ | -0.02163 | 0.0273 | -0.7922 | -0.07513 | 0.03188 | fixed |
| count_birth_order2/5+ | -0.04792 | 0.0276 | -1.736 | -0.102 | 0.006187 | fixed |
| count_birth_order3/5+ | -0.03897 | 0.02643 | -1.474 | -0.09076 | 0.01283 | fixed |
| count_birth_order4/5+ | -0.03379 | 0.02627 | -1.286 | -0.08528 | 0.0177 | fixed |
| count_birth_order5/5+ | -0.05096 | 0.02487 | -2.049 | -0.09971 | -0.002216 | fixed |
| count_birth_order5+/5+ | -0.0495 | 0.01961 | -2.524 | -0.08793 | -0.01106 | fixed |
| sd_(Intercept).mother_pidlink | 0.1183 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2362 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 608.1 | 676.7 | -293 | 586.1 | NA | NA | NA |
| 12 | 608.8 | 683.6 | -292.4 | 584.8 | 1.244 | 1 | 0.2646 |
| 16 | 614.6 | 714.3 | -291.3 | 582.6 | 2.283 | 4 | 0.6838 |
| 26 | 627.7 | 789.7 | -287.8 | 575.7 | 6.885 | 10 | 0.7363 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = `Category_Private worker`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.02918 | 0.1054 | -0.2769 | -0.2357 | 0.1774 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.05562 | 0.00946 | 5.88 | 0.03708 | 0.07416 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.001725 | 0.000266 | -6.484 | -0.002246 | -0.001203 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00001406 | 0.000002366 | 5.941 | 0.00000942 | 0.0000187 | fixed |
| male | 0.05526 | 0.00963 | 5.738 | 0.03639 | 0.07414 | fixed |
| sibling_count3 | 0.0003855 | 0.02066 | 0.01865 | -0.04012 | 0.04089 | fixed |
| sibling_count4 | -0.008148 | 0.02089 | -0.39 | -0.04909 | 0.03279 | fixed |
| sibling_count5 | -0.02683 | 0.02182 | -1.229 | -0.0696 | 0.01595 | fixed |
| sibling_count5+ | -0.0556 | 0.01685 | -3.3 | -0.08863 | -0.02258 | fixed |
| sd_(Intercept).mother_pidlink | 0.2157 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4361 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.02842 | 0.1054 | -0.2697 | -0.235 | 0.1781 | fixed |
| birth_order | -0.002304 | 0.00199 | -1.158 | -0.006205 | 0.001597 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.05627 | 0.009476 | 5.938 | 0.0377 | 0.07485 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00175 | 0.0002668 | -6.556 | -0.002273 | -0.001227 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00001429 | 0.000002374 | 6.017 | 0.000009633 | 0.00001894 | fixed |
| male | 0.05529 | 0.00963 | 5.741 | 0.03641 | 0.07416 | fixed |
| sibling_count3 | 0.0009427 | 0.02067 | 0.04561 | -0.03957 | 0.04145 | fixed |
| sibling_count4 | -0.006841 | 0.02092 | -0.327 | -0.04784 | 0.03416 | fixed |
| sibling_count5 | -0.02445 | 0.02192 | -1.116 | -0.06741 | 0.0185 | fixed |
| sibling_count5+ | -0.04769 | 0.01819 | -2.622 | -0.08333 | -0.01204 | fixed |
| sd_(Intercept).mother_pidlink | 0.2156 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4362 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.02558 | 0.1055 | -0.2424 | -0.2324 | 0.1813 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0563 | 0.009484 | 5.937 | 0.03771 | 0.07489 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.001739 | 0.000267 | -6.513 | -0.002262 | -0.001215 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00001409 | 0.000002375 | 5.932 | 0.000009435 | 0.00001875 | fixed |
| male | 0.0553 | 0.009632 | 5.741 | 0.03642 | 0.07417 | fixed |
| sibling_count3 | 0.003277 | 0.02094 | 0.1565 | -0.03777 | 0.04432 | fixed |
| sibling_count4 | -0.003538 | 0.02142 | -0.1652 | -0.04552 | 0.03844 | fixed |
| sibling_count5 | -0.02212 | 0.02258 | -0.9795 | -0.06639 | 0.02214 | fixed |
| sibling_count5+ | -0.04829 | 0.01897 | -2.546 | -0.08548 | -0.01111 | fixed |
| birth_order_nonlinear2 | -0.02808 | 0.01393 | -2.016 | -0.05538 | -0.000778 | fixed |
| birth_order_nonlinear3 | -0.02067 | 0.01617 | -1.278 | -0.05235 | 0.01102 | fixed |
| birth_order_nonlinear4 | -0.02172 | 0.01816 | -1.196 | -0.05731 | 0.01388 | fixed |
| birth_order_nonlinear5 | -0.01489 | 0.02044 | -0.7284 | -0.05494 | 0.02517 | fixed |
| birth_order_nonlinear5+ | -0.02235 | 0.01718 | -1.301 | -0.05603 | 0.01132 | fixed |
| sd_(Intercept).mother_pidlink | 0.2154 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4363 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.02217 | 0.1059 | -0.2094 | -0.2298 | 0.1854 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.05677 | 0.009494 | 5.98 | 0.03816 | 0.07538 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.001744 | 0.0002672 | -6.528 | -0.002268 | -0.001221 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00001406 | 0.000002377 | 5.916 | 0.000009403 | 0.00001872 | fixed |
| male | 0.05551 | 0.009637 | 5.76 | 0.03662 | 0.0744 | fixed |
| count_birth_order2/2 | -0.05724 | 0.02767 | -2.068 | -0.1115 | -0.003003 | fixed |
| count_birth_order1/3 | 0.0003303 | 0.02726 | 0.01212 | -0.05309 | 0.05375 | fixed |
| count_birth_order2/3 | -0.03185 | 0.03017 | -1.056 | -0.09097 | 0.02727 | fixed |
| count_birth_order3/3 | -0.04859 | 0.03309 | -1.469 | -0.1134 | 0.01626 | fixed |
| count_birth_order1/4 | -0.005195 | 0.02981 | -0.1743 | -0.06363 | 0.05324 | fixed |
| count_birth_order2/4 | -0.03899 | 0.03194 | -1.221 | -0.1016 | 0.02361 | fixed |
| count_birth_order3/4 | -0.0355 | 0.03402 | -1.043 | -0.1022 | 0.03118 | fixed |
| count_birth_order4/4 | -0.0587 | 0.03611 | -1.626 | -0.1295 | 0.01207 | fixed |
| count_birth_order1/5 | -0.02741 | 0.0338 | -0.8109 | -0.09366 | 0.03884 | fixed |
| count_birth_order2/5 | -0.06241 | 0.03582 | -1.742 | -0.1326 | 0.007795 | fixed |
| count_birth_order3/5 | -0.07078 | 0.03768 | -1.879 | -0.1446 | 0.003066 | fixed |
| count_birth_order4/5 | -0.03619 | 0.03954 | -0.9152 | -0.1137 | 0.04131 | fixed |
| count_birth_order5/5 | -0.0552 | 0.03957 | -1.395 | -0.1327 | 0.02235 | fixed |
| count_birth_order1/5+ | -0.08694 | 0.026 | -3.343 | -0.1379 | -0.03597 | fixed |
| count_birth_order2/5+ | -0.07812 | 0.02706 | -2.887 | -0.1312 | -0.02509 | fixed |
| count_birth_order3/5+ | -0.06474 | 0.02665 | -2.429 | -0.117 | -0.0125 | fixed |
| count_birth_order4/5+ | -0.07889 | 0.0262 | -3.012 | -0.1302 | -0.02755 | fixed |
| count_birth_order5/5+ | -0.07251 | 0.02647 | -2.739 | -0.1244 | -0.02062 | fixed |
| count_birth_order5+/5+ | -0.08181 | 0.0217 | -3.77 | -0.1243 | -0.03927 | fixed |
| sd_(Intercept).mother_pidlink | 0.2159 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4362 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 13876 | 13956 | -6927 | 13854 | NA | NA | NA |
| 12 | 13877 | 13964 | -6927 | 13853 | 1.343 | 1 | 0.2466 |
| 16 | 13882 | 13997 | -6925 | 13850 | 3.301 | 4 | 0.5088 |
| 26 | 13895 | 14083 | -6922 | 13843 | 6.494 | 10 | 0.7722 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.026 | 0.3156 | -6.419 | -2.644 | -1.407 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2738 | 0.03387 | 8.083 | 0.2074 | 0.3402 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.008982 | 0.001162 | -7.732 | -0.01126 | -0.006705 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00009119 | 0.00001275 | 7.151 | 0.0000662 | 0.0001162 | fixed |
| male | 0.03804 | 0.01584 | 2.401 | 0.00698 | 0.06909 | fixed |
| sibling_count3 | -0.03885 | 0.0269 | -1.444 | -0.09158 | 0.01387 | fixed |
| sibling_count4 | -0.03699 | 0.02791 | -1.325 | -0.09169 | 0.01771 | fixed |
| sibling_count5 | -0.07355 | 0.03119 | -2.358 | -0.1347 | -0.01243 | fixed |
| sibling_count5+ | -0.1243 | 0.02709 | -4.59 | -0.1774 | -0.07124 | fixed |
| sd_(Intercept).mother_pidlink | 0.2278 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4351 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.023 | 0.3157 | -6.408 | -2.642 | -1.404 | fixed |
| birth_order | 0.002475 | 0.00498 | 0.4971 | -0.007285 | 0.01224 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2732 | 0.0339 | 8.058 | 0.2067 | 0.3396 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.008966 | 0.001162 | -7.714 | -0.01124 | -0.006688 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00009112 | 0.00001275 | 7.145 | 0.00006613 | 0.0001161 | fixed |
| male | 0.03797 | 0.01585 | 2.396 | 0.006908 | 0.06903 | fixed |
| sibling_count3 | -0.04015 | 0.02703 | -1.485 | -0.09314 | 0.01283 | fixed |
| sibling_count4 | -0.0398 | 0.02848 | -1.398 | -0.09562 | 0.01602 | fixed |
| sibling_count5 | -0.07815 | 0.03254 | -2.402 | -0.1419 | -0.01438 | fixed |
| sibling_count5+ | -0.1334 | 0.03264 | -4.087 | -0.1973 | -0.06941 | fixed |
| sd_(Intercept).mother_pidlink | 0.228 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4351 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.027 | 0.3161 | -6.411 | -2.646 | -1.407 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2741 | 0.03392 | 8.08 | 0.2076 | 0.3405 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.009001 | 0.001163 | -7.739 | -0.01128 | -0.006721 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00009161 | 0.00001277 | 7.176 | 0.00006659 | 0.0001166 | fixed |
| male | 0.0381 | 0.01585 | 2.403 | 0.007026 | 0.06917 | fixed |
| sibling_count3 | -0.03972 | 0.02752 | -1.443 | -0.09365 | 0.01421 | fixed |
| sibling_count4 | -0.03822 | 0.0294 | -1.3 | -0.09584 | 0.0194 | fixed |
| sibling_count5 | -0.08413 | 0.03393 | -2.48 | -0.1506 | -0.01764 | fixed |
| sibling_count5+ | -0.1433 | 0.03342 | -4.287 | -0.2088 | -0.07778 | fixed |
| birth_order_nonlinear2 | -0.00469 | 0.02067 | -0.2269 | -0.0452 | 0.03582 | fixed |
| birth_order_nonlinear3 | 0.002097 | 0.02435 | 0.08612 | -0.04563 | 0.04982 | fixed |
| birth_order_nonlinear4 | -0.001416 | 0.0297 | -0.04766 | -0.05964 | 0.0568 | fixed |
| birth_order_nonlinear5 | 0.04611 | 0.03654 | 1.262 | -0.0255 | 0.1177 | fixed |
| birth_order_nonlinear5+ | 0.0272 | 0.03676 | 0.7398 | -0.04486 | 0.09925 | fixed |
| sd_(Intercept).mother_pidlink | 0.2275 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4354 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.078 | 0.3173 | -6.548 | -2.7 | -1.456 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2796 | 0.03406 | 8.211 | 0.2129 | 0.3464 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.009203 | 0.001168 | -7.879 | -0.01149 | -0.006913 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00009392 | 0.00001282 | 7.324 | 0.00006879 | 0.0001191 | fixed |
| male | 0.03892 | 0.01588 | 2.451 | 0.007802 | 0.07005 | fixed |
| count_birth_order2/2 | 0.005079 | 0.04026 | 0.1262 | -0.07383 | 0.08399 | fixed |
| count_birth_order1/3 | -0.02901 | 0.03467 | -0.8367 | -0.09695 | 0.03894 | fixed |
| count_birth_order2/3 | -0.04598 | 0.03843 | -1.197 | -0.1213 | 0.02933 | fixed |
| count_birth_order3/3 | -0.0427 | 0.04151 | -1.029 | -0.1241 | 0.03866 | fixed |
| count_birth_order1/4 | -0.01582 | 0.03976 | -0.3978 | -0.09375 | 0.06211 | fixed |
| count_birth_order2/4 | -0.03676 | 0.04174 | -0.8806 | -0.1186 | 0.04506 | fixed |
| count_birth_order3/4 | -0.02532 | 0.04372 | -0.579 | -0.111 | 0.06038 | fixed |
| count_birth_order4/4 | -0.08068 | 0.04636 | -1.74 | -0.1715 | 0.01018 | fixed |
| count_birth_order1/5 | -0.07601 | 0.05206 | -1.46 | -0.178 | 0.02603 | fixed |
| count_birth_order2/5 | -0.1138 | 0.05651 | -2.014 | -0.2246 | -0.00306 | fixed |
| count_birth_order3/5 | -0.03707 | 0.05297 | -0.6999 | -0.1409 | 0.06674 | fixed |
| count_birth_order4/5 | -0.1023 | 0.05152 | -1.986 | -0.2033 | -0.001362 | fixed |
| count_birth_order5/5 | -0.03525 | 0.054 | -0.6528 | -0.1411 | 0.07058 | fixed |
| count_birth_order1/5+ | -0.1897 | 0.04946 | -3.835 | -0.2866 | -0.09274 | fixed |
| count_birth_order2/5+ | -0.13 | 0.04983 | -2.609 | -0.2277 | -0.03232 | fixed |
| count_birth_order3/5+ | -0.1686 | 0.0487 | -3.462 | -0.264 | -0.07314 | fixed |
| count_birth_order4/5+ | -0.08096 | 0.04728 | -1.712 | -0.1736 | 0.0117 | fixed |
| count_birth_order5/5+ | -0.09381 | 0.04561 | -2.057 | -0.1832 | -0.004414 | fixed |
| count_birth_order5+/5+ | -0.1121 | 0.03598 | -3.115 | -0.1826 | -0.04156 | fixed |
| sd_(Intercept).mother_pidlink | 0.2282 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4353 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 5366 | 5435 | -2672 | 5344 | NA | NA | NA |
| 12 | 5368 | 5443 | -2672 | 5344 | 0.2466 | 1 | 0.6195 |
| 16 | 5374 | 5474 | -2671 | 5342 | 2.082 | 4 | 0.7207 |
| 26 | 5386 | 5549 | -2667 | 5334 | 8.045 | 10 | 0.6245 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.018 | 0.3145 | -6.417 | -2.635 | -1.402 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.272 | 0.03379 | 8.048 | 0.2057 | 0.3382 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.008924 | 0.001159 | -7.699 | -0.0112 | -0.006652 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00009054 | 0.00001273 | 7.114 | 0.00006559 | 0.0001155 | fixed |
| male | 0.03847 | 0.0158 | 2.434 | 0.007495 | 0.06945 | fixed |
| sibling_count3 | -0.01225 | 0.02948 | -0.4156 | -0.07003 | 0.04553 | fixed |
| sibling_count4 | -0.02102 | 0.0298 | -0.7053 | -0.07942 | 0.03739 | fixed |
| sibling_count5 | -0.04856 | 0.03152 | -1.541 | -0.1103 | 0.01322 | fixed |
| sibling_count5+ | -0.09925 | 0.02759 | -3.598 | -0.1533 | -0.04518 | fixed |
| sd_(Intercept).mother_pidlink | 0.2287 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4351 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.02 | 0.3146 | -6.42 | -2.636 | -1.403 | fixed |
| birth_order | -0.001348 | 0.004409 | -0.3058 | -0.009989 | 0.007293 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2723 | 0.03381 | 8.053 | 0.206 | 0.3386 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.008932 | 0.00116 | -7.703 | -0.0112 | -0.00666 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00009057 | 0.00001273 | 7.115 | 0.00006562 | 0.0001155 | fixed |
| male | 0.0385 | 0.01581 | 2.436 | 0.007519 | 0.06948 | fixed |
| sibling_count3 | -0.01153 | 0.02958 | -0.3896 | -0.0695 | 0.04645 | fixed |
| sibling_count4 | -0.01958 | 0.03017 | -0.6491 | -0.07871 | 0.03954 | fixed |
| sibling_count5 | -0.04622 | 0.03244 | -1.425 | -0.1098 | 0.01735 | fixed |
| sibling_count5+ | -0.09442 | 0.03179 | -2.971 | -0.1567 | -0.03212 | fixed |
| sd_(Intercept).mother_pidlink | 0.2286 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4352 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.011 | 0.315 | -6.386 | -2.629 | -1.394 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2716 | 0.03383 | 8.03 | 0.2053 | 0.3379 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.008913 | 0.00116 | -7.682 | -0.01119 | -0.006639 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00009045 | 0.00001274 | 7.1 | 0.00006548 | 0.0001154 | fixed |
| male | 0.03842 | 0.01581 | 2.43 | 0.007433 | 0.06941 | fixed |
| sibling_count3 | -0.01008 | 0.03005 | -0.3354 | -0.06897 | 0.04881 | fixed |
| sibling_count4 | -0.01969 | 0.03098 | -0.6358 | -0.08041 | 0.04102 | fixed |
| sibling_count5 | -0.05592 | 0.03372 | -1.658 | -0.122 | 0.01017 | fixed |
| sibling_count5+ | -0.103 | 0.03261 | -3.158 | -0.1669 | -0.03907 | fixed |
| birth_order_nonlinear2 | -0.01341 | 0.02097 | -0.6398 | -0.05451 | 0.02768 | fixed |
| birth_order_nonlinear3 | -0.01003 | 0.02451 | -0.409 | -0.05807 | 0.03802 | fixed |
| birth_order_nonlinear4 | 0.000195 | 0.02903 | 0.006718 | -0.0567 | 0.05709 | fixed |
| birth_order_nonlinear5 | 0.04181 | 0.03537 | 1.182 | -0.02752 | 0.1111 | fixed |
| birth_order_nonlinear5+ | -0.009151 | 0.0333 | -0.2748 | -0.07443 | 0.05612 | fixed |
| sd_(Intercept).mother_pidlink | 0.228 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4355 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.009 | 0.3158 | -6.363 | -2.628 | -1.39 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2733 | 0.03392 | 8.058 | 0.2068 | 0.3398 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.008987 | 0.001164 | -7.723 | -0.01127 | -0.006706 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00009141 | 0.00001278 | 7.153 | 0.00006637 | 0.0001165 | fixed |
| male | 0.03913 | 0.01584 | 2.471 | 0.008089 | 0.07016 | fixed |
| count_birth_order2/2 | -0.05345 | 0.04441 | -1.204 | -0.1405 | 0.03359 | fixed |
| count_birth_order1/3 | -0.01953 | 0.03832 | -0.5096 | -0.09464 | 0.05558 | fixed |
| count_birth_order2/3 | -0.04084 | 0.04163 | -0.981 | -0.1224 | 0.04075 | fixed |
| count_birth_order3/3 | -0.03316 | 0.04571 | -0.7255 | -0.1228 | 0.05643 | fixed |
| count_birth_order1/4 | -0.04812 | 0.04163 | -1.156 | -0.1297 | 0.03348 | fixed |
| count_birth_order2/4 | -0.03541 | 0.04338 | -0.8163 | -0.1204 | 0.04962 | fixed |
| count_birth_order3/4 | -0.01073 | 0.04735 | -0.2265 | -0.1035 | 0.08208 | fixed |
| count_birth_order4/4 | -0.05686 | 0.05053 | -1.125 | -0.1559 | 0.04216 | fixed |
| count_birth_order1/5 | -0.04768 | 0.04983 | -0.9569 | -0.1453 | 0.04998 | fixed |
| count_birth_order2/5 | -0.08619 | 0.05169 | -1.667 | -0.1875 | 0.01512 | fixed |
| count_birth_order3/5 | -0.05817 | 0.05257 | -1.106 | -0.1612 | 0.04488 | fixed |
| count_birth_order4/5 | -0.129 | 0.05342 | -2.416 | -0.2338 | -0.02435 | fixed |
| count_birth_order5/5 | -0.009836 | 0.05381 | -0.1828 | -0.1153 | 0.09563 | fixed |
| count_birth_order1/5+ | -0.1407 | 0.04506 | -3.123 | -0.229 | -0.0524 | fixed |
| count_birth_order2/5+ | -0.1041 | 0.04751 | -2.191 | -0.1972 | -0.01097 | fixed |
| count_birth_order3/5+ | -0.1657 | 0.04577 | -3.621 | -0.2554 | -0.07601 | fixed |
| count_birth_order4/5+ | -0.06336 | 0.04463 | -1.42 | -0.1508 | 0.02411 | fixed |
| count_birth_order5/5+ | -0.08578 | 0.04716 | -1.819 | -0.1782 | 0.00664 | fixed |
| count_birth_order5+/5+ | -0.1241 | 0.03602 | -3.446 | -0.1947 | -0.05354 | fixed |
| sd_(Intercept).mother_pidlink | 0.2294 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.435 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 5409 | 5477 | -2693 | 5387 | NA | NA | NA |
| 12 | 5410 | 5486 | -2693 | 5386 | 0.09448 | 1 | 0.7586 |
| 16 | 5416 | 5516 | -2692 | 5384 | 2.809 | 4 | 0.5902 |
| 26 | 5426 | 5589 | -2687 | 5374 | 9.447 | 10 | 0.4903 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.997 | 0.3192 | -6.256 | -2.622 | -1.371 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2714 | 0.03431 | 7.912 | 0.2042 | 0.3387 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.008929 | 0.001178 | -7.582 | -0.01124 | -0.006621 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00009099 | 0.00001294 | 7.031 | 0.00006562 | 0.0001164 | fixed |
| male | 0.0349 | 0.01601 | 2.18 | 0.003529 | 0.06628 | fixed |
| sibling_count3 | -0.04555 | 0.02637 | -1.727 | -0.09725 | 0.006137 | fixed |
| sibling_count4 | -0.04056 | 0.02775 | -1.462 | -0.09495 | 0.01383 | fixed |
| sibling_count5 | -0.0787 | 0.03189 | -2.468 | -0.1412 | -0.01619 | fixed |
| sibling_count5+ | -0.1247 | 0.02725 | -4.577 | -0.1781 | -0.07132 | fixed |
| sd_(Intercept).mother_pidlink | 0.227 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.436 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.994 | 0.3193 | -6.245 | -2.62 | -1.368 | fixed |
| birth_order | 0.002076 | 0.005125 | 0.405 | -0.00797 | 0.01212 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2708 | 0.03434 | 7.887 | 0.2035 | 0.3381 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.008913 | 0.001178 | -7.564 | -0.01122 | -0.006603 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00009091 | 0.00001294 | 7.023 | 0.00006554 | 0.0001163 | fixed |
| male | 0.03489 | 0.01601 | 2.18 | 0.003515 | 0.06627 | fixed |
| sibling_count3 | -0.04667 | 0.02652 | -1.76 | -0.09865 | 0.005312 | fixed |
| sibling_count4 | -0.04288 | 0.02834 | -1.513 | -0.09842 | 0.01266 | fixed |
| sibling_count5 | -0.08244 | 0.03322 | -2.482 | -0.1475 | -0.01734 | fixed |
| sibling_count5+ | -0.1323 | 0.03304 | -4.004 | -0.1971 | -0.06753 | fixed |
| sd_(Intercept).mother_pidlink | 0.2272 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.436 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.999 | 0.3196 | -6.253 | -2.625 | -1.372 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2719 | 0.03435 | 7.916 | 0.2046 | 0.3393 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.008956 | 0.001179 | -7.596 | -0.01127 | -0.006645 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000915 | 0.00001295 | 7.063 | 0.00006611 | 0.0001169 | fixed |
| male | 0.03526 | 0.01602 | 2.201 | 0.003867 | 0.06665 | fixed |
| sibling_count3 | -0.04768 | 0.02702 | -1.764 | -0.1006 | 0.005292 | fixed |
| sibling_count4 | -0.04006 | 0.02926 | -1.369 | -0.09741 | 0.0173 | fixed |
| sibling_count5 | -0.08599 | 0.03453 | -2.49 | -0.1537 | -0.01831 | fixed |
| sibling_count5+ | -0.1441 | 0.03388 | -4.252 | -0.2105 | -0.07766 | fixed |
| birth_order_nonlinear2 | -0.008968 | 0.02059 | -0.4354 | -0.04933 | 0.0314 | fixed |
| birth_order_nonlinear3 | 0.006384 | 0.02441 | 0.2616 | -0.04145 | 0.05422 | fixed |
| birth_order_nonlinear4 | -0.01746 | 0.03063 | -0.5702 | -0.0775 | 0.04257 | fixed |
| birth_order_nonlinear5 | 0.03934 | 0.03771 | 1.043 | -0.03458 | 0.1133 | fixed |
| birth_order_nonlinear5+ | 0.03292 | 0.03794 | 0.8678 | -0.04143 | 0.1073 | fixed |
| sd_(Intercept).mother_pidlink | 0.2269 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4362 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -2.036 | 0.3208 | -6.347 | -2.665 | -1.407 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.2765 | 0.03449 | 8.018 | 0.2089 | 0.3441 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.009123 | 0.001184 | -7.705 | -0.01144 | -0.006803 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00009344 | 0.00001301 | 7.18 | 0.00006793 | 0.0001189 | fixed |
| male | 0.03622 | 0.01605 | 2.257 | 0.004772 | 0.06768 | fixed |
| count_birth_order2/2 | -0.01423 | 0.03915 | -0.3636 | -0.09096 | 0.0625 | fixed |
| count_birth_order1/3 | -0.04654 | 0.03411 | -1.364 | -0.1134 | 0.02032 | fixed |
| count_birth_order2/3 | -0.06353 | 0.03785 | -1.678 | -0.1377 | 0.01065 | fixed |
| count_birth_order3/3 | -0.04164 | 0.04047 | -1.029 | -0.121 | 0.03768 | fixed |
| count_birth_order1/4 | -0.02181 | 0.03994 | -0.546 | -0.1001 | 0.05648 | fixed |
| count_birth_order2/4 | -0.03984 | 0.04167 | -0.9562 | -0.1215 | 0.04183 | fixed |
| count_birth_order3/4 | -0.03702 | 0.04363 | -0.8485 | -0.1225 | 0.04849 | fixed |
| count_birth_order4/4 | -0.1064 | 0.04703 | -2.262 | -0.1986 | -0.0142 | fixed |
| count_birth_order1/5 | -0.08905 | 0.05217 | -1.707 | -0.1913 | 0.0132 | fixed |
| count_birth_order2/5 | -0.1309 | 0.05835 | -2.243 | -0.2452 | -0.0165 | fixed |
| count_birth_order3/5 | -0.04651 | 0.05591 | -0.8318 | -0.1561 | 0.06307 | fixed |
| count_birth_order4/5 | -0.1053 | 0.05394 | -1.953 | -0.2111 | 0.0003803 | fixed |
| count_birth_order5/5 | -0.04859 | 0.05676 | -0.856 | -0.1598 | 0.06266 | fixed |
| count_birth_order1/5+ | -0.1966 | 0.05077 | -3.873 | -0.2961 | -0.09713 | fixed |
| count_birth_order2/5+ | -0.1305 | 0.05132 | -2.542 | -0.2311 | -0.02987 | fixed |
| count_birth_order3/5+ | -0.1642 | 0.04914 | -3.341 | -0.2605 | -0.06785 | fixed |
| count_birth_order4/5+ | -0.1132 | 0.04884 | -2.318 | -0.2089 | -0.0175 | fixed |
| count_birth_order5/5+ | -0.1064 | 0.04624 | -2.302 | -0.1971 | -0.01581 | fixed |
| count_birth_order5+/5+ | -0.112 | 0.03652 | -3.067 | -0.1836 | -0.04044 | fixed |
| sd_(Intercept).mother_pidlink | 0.2272 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4363 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 5279 | 5348 | -2629 | 5257 | NA | NA | NA |
| 12 | 5281 | 5356 | -2628 | 5257 | 0.1631 | 1 | 0.6863 |
| 16 | 5286 | 5386 | -2627 | 5254 | 2.91 | 4 | 0.573 |
| 26 | 5299 | 5461 | -2624 | 5247 | 6.613 | 10 | 0.7614 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = `Category_Self-employed`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.2665 | 0.095 | -2.805 | -0.4527 | -0.08029 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02362 | 0.008521 | 2.772 | 0.006922 | 0.04033 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001646 | 0.0002393 | -0.6879 | -0.0006336 | 0.0003044 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000002153 | 0.000002126 | -0.1013 | -0.000004382 | 0.000003952 | fixed |
| male | -0.002977 | 0.008766 | -0.3396 | -0.02016 | 0.0142 | fixed |
| sibling_count3 | -0.02246 | 0.01828 | -1.229 | -0.05828 | 0.01337 | fixed |
| sibling_count4 | -0.01987 | 0.01844 | -1.077 | -0.056 | 0.01627 | fixed |
| sibling_count5 | -0.01023 | 0.01921 | -0.5326 | -0.04789 | 0.02743 | fixed |
| sibling_count5+ | 0.01732 | 0.0149 | 1.162 | -0.01188 | 0.04651 | fixed |
| sd_(Intercept).mother_pidlink | 0.1531 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4098 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.2668 | 0.09499 | -2.809 | -0.453 | -0.08063 | fixed |
| birth_order | 0.002029 | 0.001784 | 1.137 | -0.001469 | 0.005526 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02307 | 0.008535 | 2.703 | 0.006339 | 0.0398 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001441 | 0.00024 | -0.6006 | -0.0006145 | 0.0003262 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000004013 | 0.000002132 | -0.1882 | -0.00000458 | 0.000003778 | fixed |
| male | -0.003007 | 0.008766 | -0.3431 | -0.02019 | 0.01417 | fixed |
| sibling_count3 | -0.023 | 0.01828 | -1.258 | -0.05884 | 0.01283 | fixed |
| sibling_count4 | -0.0211 | 0.01847 | -1.143 | -0.0573 | 0.01509 | fixed |
| sibling_count5 | -0.01241 | 0.01931 | -0.6426 | -0.05025 | 0.02544 | fixed |
| sibling_count5+ | 0.01022 | 0.01615 | 0.6328 | -0.02144 | 0.04188 | fixed |
| sd_(Intercept).mother_pidlink | 0.1529 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4098 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.2752 | 0.09511 | -2.893 | -0.4616 | -0.08877 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02319 | 0.008541 | 2.715 | 0.00645 | 0.03993 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001598 | 0.0002401 | -0.6657 | -0.0006303 | 0.0003107 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000001582 | 0.000002133 | -0.07415 | -0.000004338 | 0.000004022 | fixed |
| male | -0.003111 | 0.008765 | -0.3549 | -0.02029 | 0.01407 | fixed |
| sibling_count3 | -0.02462 | 0.01855 | -1.327 | -0.06098 | 0.01173 | fixed |
| sibling_count4 | -0.02199 | 0.01896 | -1.16 | -0.05915 | 0.01517 | fixed |
| sibling_count5 | -0.01296 | 0.01996 | -0.6493 | -0.05208 | 0.02616 | fixed |
| sibling_count5+ | 0.01309 | 0.01691 | 0.7741 | -0.02005 | 0.04623 | fixed |
| birth_order_nonlinear2 | 0.03823 | 0.01276 | 2.997 | 0.01323 | 0.06324 | fixed |
| birth_order_nonlinear3 | 0.01961 | 0.01483 | 1.322 | -0.009457 | 0.04867 | fixed |
| birth_order_nonlinear4 | 0.0146 | 0.01665 | 0.877 | -0.01803 | 0.04724 | fixed |
| birth_order_nonlinear5 | 0.01968 | 0.01874 | 1.05 | -0.01704 | 0.0564 | fixed |
| birth_order_nonlinear5+ | 0.02218 | 0.01558 | 1.423 | -0.008359 | 0.05271 | fixed |
| sd_(Intercept).mother_pidlink | 0.1529 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4097 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.2834 | 0.09546 | -2.969 | -0.4705 | -0.09631 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02291 | 0.008548 | 2.68 | 0.006152 | 0.03966 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0001582 | 0.0002402 | -0.6585 | -0.000629 | 0.0003126 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000000111 | 0.000002134 | -0.052 | -0.000004293 | 0.000004072 | fixed |
| male | -0.003372 | 0.008769 | -0.3845 | -0.02056 | 0.01382 | fixed |
| count_birth_order2/2 | 0.07421 | 0.02534 | 2.928 | 0.02454 | 0.1239 | fixed |
| count_birth_order1/3 | -0.02418 | 0.02456 | -0.9844 | -0.07231 | 0.02396 | fixed |
| count_birth_order2/3 | 0.03323 | 0.02722 | 1.221 | -0.02011 | 0.08657 | fixed |
| count_birth_order3/3 | 0.02459 | 0.02989 | 0.8229 | -0.03398 | 0.08317 | fixed |
| count_birth_order1/4 | 0.01501 | 0.0269 | 0.5579 | -0.03772 | 0.06773 | fixed |
| count_birth_order2/4 | 0.005201 | 0.02884 | 0.1804 | -0.05132 | 0.06173 | fixed |
| count_birth_order3/4 | -0.005191 | 0.03075 | -0.1688 | -0.06545 | 0.05507 | fixed |
| count_birth_order4/4 | 0.01914 | 0.03266 | 0.5862 | -0.04486 | 0.08315 | fixed |
| count_birth_order1/5 | 0.009117 | 0.03054 | 0.2985 | -0.05074 | 0.06897 | fixed |
| count_birth_order2/5 | 0.04643 | 0.03238 | 1.434 | -0.01704 | 0.1099 | fixed |
| count_birth_order3/5 | 0.03461 | 0.03409 | 1.015 | -0.0322 | 0.1014 | fixed |
| count_birth_order4/5 | -0.01429 | 0.03583 | -0.3989 | -0.08451 | 0.05593 | fixed |
| count_birth_order5/5 | 0.0102 | 0.03582 | 0.2846 | -0.06001 | 0.0804 | fixed |
| count_birth_order1/5+ | 0.03492 | 0.02352 | 1.485 | -0.01118 | 0.08102 | fixed |
| count_birth_order2/5+ | 0.05428 | 0.02449 | 2.216 | 0.006268 | 0.1023 | fixed |
| count_birth_order3/5+ | 0.04115 | 0.02413 | 1.705 | -0.006149 | 0.08844 | fixed |
| count_birth_order4/5+ | 0.04521 | 0.0237 | 1.907 | -0.001244 | 0.09166 | fixed |
| count_birth_order5/5+ | 0.04958 | 0.02396 | 2.069 | 0.002613 | 0.09655 | fixed |
| count_birth_order5+/5+ | 0.04898 | 0.01941 | 2.523 | 0.01094 | 0.08703 | fixed |
| sd_(Intercept).mother_pidlink | 0.153 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4097 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 11871 | 11950 | -5924 | 11849 | NA | NA | NA |
| 12 | 11871 | 11958 | -5924 | 11847 | 1.295 | 1 | 0.2552 |
| 16 | 11872 | 11987 | -5920 | 11840 | 7.919 | 4 | 0.0946 |
| 26 | 11883 | 12071 | -5916 | 11831 | 8.217 | 10 | 0.6077 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9428 | 0.2612 | 3.609 | 0.4307 | 1.455 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1058 | 0.02805 | -3.773 | -0.1608 | -0.05087 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.004147 | 0.0009623 | 4.309 | 0.002261 | 0.006033 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004614 | 0.00001056 | -4.368 | -0.00006685 | -0.00002544 | fixed |
| male | -0.02367 | 0.01315 | -1.8 | -0.04943 | 0.0021 | fixed |
| sibling_count3 | 0.01552 | 0.02194 | 0.7075 | -0.02747 | 0.05851 | fixed |
| sibling_count4 | -0.02907 | 0.02271 | -1.28 | -0.07358 | 0.01545 | fixed |
| sibling_count5 | 0.03856 | 0.02531 | 1.524 | -0.01104 | 0.08815 | fixed |
| sibling_count5+ | 0.04773 | 0.02198 | 2.172 | 0.00465 | 0.09081 | fixed |
| sd_(Intercept).mother_pidlink | 0.1578 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3721 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9413 | 0.2613 | 3.602 | 0.4291 | 1.453 | fixed |
| birth_order | -0.001447 | 0.004107 | -0.3524 | -0.009497 | 0.006603 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1055 | 0.02807 | -3.759 | -0.1605 | -0.05049 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.004138 | 0.0009626 | 4.299 | 0.002251 | 0.006025 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004611 | 0.00001057 | -4.364 | -0.00006682 | -0.0000254 | fixed |
| male | -0.02362 | 0.01315 | -1.796 | -0.04939 | 0.002152 | fixed |
| sibling_count3 | 0.01627 | 0.02204 | 0.7382 | -0.02693 | 0.05948 | fixed |
| sibling_count4 | -0.02744 | 0.02318 | -1.184 | -0.07288 | 0.01799 | fixed |
| sibling_count5 | 0.0412 | 0.02642 | 1.559 | -0.01058 | 0.09299 | fixed |
| sibling_count5+ | 0.05295 | 0.02654 | 1.995 | 0.0009406 | 0.105 | fixed |
| sd_(Intercept).mother_pidlink | 0.1582 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.372 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9329 | 0.2617 | 3.565 | 0.42 | 1.446 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1051 | 0.02809 | -3.742 | -0.1602 | -0.05006 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.004127 | 0.0009634 | 4.283 | 0.002238 | 0.006015 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004607 | 0.00001058 | -4.355 | -0.0000668 | -0.00002534 | fixed |
| male | -0.02352 | 0.01315 | -1.788 | -0.0493 | 0.002267 | fixed |
| sibling_count3 | 0.0156 | 0.02247 | 0.6942 | -0.02844 | 0.05964 | fixed |
| sibling_count4 | -0.02767 | 0.02398 | -1.154 | -0.07467 | 0.01933 | fixed |
| sibling_count5 | 0.04284 | 0.02763 | 1.55 | -0.01132 | 0.09699 | fixed |
| sibling_count5+ | 0.0613 | 0.02722 | 2.252 | 0.007956 | 0.1147 | fixed |
| birth_order_nonlinear2 | 0.01025 | 0.01727 | 0.5934 | -0.02361 | 0.04411 | fixed |
| birth_order_nonlinear3 | 0.001374 | 0.02033 | 0.06759 | -0.03848 | 0.04123 | fixed |
| birth_order_nonlinear4 | -0.002639 | 0.02479 | -0.1065 | -0.05122 | 0.04594 | fixed |
| birth_order_nonlinear5 | -0.008891 | 0.03048 | -0.2917 | -0.06864 | 0.05086 | fixed |
| birth_order_nonlinear5+ | -0.02557 | 0.03043 | -0.8404 | -0.08522 | 0.03407 | fixed |
| sd_(Intercept).mother_pidlink | 0.1581 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3722 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9316 | 0.2628 | 3.545 | 0.4166 | 1.447 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1065 | 0.02821 | -3.774 | -0.1618 | -0.05117 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.004174 | 0.0009678 | 4.313 | 0.002277 | 0.006071 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004658 | 0.00001063 | -4.383 | -0.00006741 | -0.00002575 | fixed |
| male | -0.02415 | 0.01318 | -1.832 | -0.04998 | 0.001684 | fixed |
| count_birth_order2/2 | 0.05231 | 0.0336 | 1.557 | -0.01355 | 0.1182 | fixed |
| count_birth_order1/3 | 0.03981 | 0.02861 | 1.392 | -0.01626 | 0.09589 | fixed |
| count_birth_order2/3 | 0.03881 | 0.03176 | 1.222 | -0.02344 | 0.1011 | fixed |
| count_birth_order3/3 | 0.01045 | 0.03434 | 0.3044 | -0.05685 | 0.07775 | fixed |
| count_birth_order1/4 | -0.008259 | 0.03285 | -0.2514 | -0.07264 | 0.05612 | fixed |
| count_birth_order2/4 | -0.02985 | 0.03453 | -0.8646 | -0.09752 | 0.03782 | fixed |
| count_birth_order3/4 | -0.01272 | 0.0362 | -0.3513 | -0.08366 | 0.05823 | fixed |
| count_birth_order4/4 | 0.008705 | 0.03839 | 0.2267 | -0.06654 | 0.08395 | fixed |
| count_birth_order1/5 | 0.05321 | 0.04307 | 1.235 | -0.03121 | 0.1376 | fixed |
| count_birth_order2/5 | 0.07654 | 0.04684 | 1.634 | -0.01527 | 0.1684 | fixed |
| count_birth_order3/5 | 0.06749 | 0.04389 | 1.538 | -0.01854 | 0.1535 | fixed |
| count_birth_order4/5 | 0.05473 | 0.04269 | 1.282 | -0.02895 | 0.1384 | fixed |
| count_birth_order5/5 | 0.02978 | 0.04476 | 0.6652 | -0.05796 | 0.1175 | fixed |
| count_birth_order1/5+ | 0.07785 | 0.04095 | 1.901 | -0.002414 | 0.1581 | fixed |
| count_birth_order2/5+ | 0.07465 | 0.04131 | 1.807 | -0.006317 | 0.1556 | fixed |
| count_birth_order3/5+ | 0.09799 | 0.04038 | 2.426 | 0.01884 | 0.1771 | fixed |
| count_birth_order4/5+ | 0.04506 | 0.03922 | 1.149 | -0.0318 | 0.1219 | fixed |
| count_birth_order5/5+ | 0.07709 | 0.03782 | 2.038 | 0.00296 | 0.1512 | fixed |
| count_birth_order5+/5+ | 0.04905 | 0.0296 | 1.657 | -0.008953 | 0.1071 | fixed |
| sd_(Intercept).mother_pidlink | 0.1579 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3725 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 3908 | 3977 | -1943 | 3886 | NA | NA | NA |
| 12 | 3910 | 3985 | -1943 | 3886 | 0.122 | 1 | 0.7269 |
| 16 | 3917 | 4017 | -1942 | 3885 | 1.352 | 4 | 0.8525 |
| 26 | 3931 | 4094 | -1940 | 3879 | 5.638 | 10 | 0.8447 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.917 | 0.2603 | 3.523 | 0.4068 | 1.427 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1019 | 0.02798 | -3.642 | -0.1567 | -0.04707 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.004027 | 0.0009598 | 4.196 | 0.002146 | 0.005909 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004496 | 0.00001054 | -4.266 | -0.00006562 | -0.0000243 | fixed |
| male | -0.02421 | 0.01311 | -1.847 | -0.04991 | 0.001481 | fixed |
| sibling_count3 | -0.006695 | 0.02405 | -0.2784 | -0.05383 | 0.04044 | fixed |
| sibling_count4 | -0.03614 | 0.02428 | -1.489 | -0.08372 | 0.01144 | fixed |
| sibling_count5 | -0.008562 | 0.02563 | -0.3341 | -0.05879 | 0.04167 | fixed |
| sibling_count5+ | 0.0278 | 0.02245 | 1.238 | -0.0162 | 0.0718 | fixed |
| sd_(Intercept).mother_pidlink | 0.1587 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.372 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9174 | 0.2603 | 3.524 | 0.4071 | 1.428 | fixed |
| birth_order | 0.0004435 | 0.003628 | 0.1222 | -0.006668 | 0.007555 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.102 | 0.02799 | -3.644 | -0.1568 | -0.04713 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00403 | 0.0009601 | 4.197 | 0.002148 | 0.005911 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004497 | 0.00001054 | -4.266 | -0.00006563 | -0.00002431 | fixed |
| male | -0.02422 | 0.01311 | -1.848 | -0.04992 | 0.001474 | fixed |
| sibling_count3 | -0.006931 | 0.02413 | -0.2872 | -0.05422 | 0.04036 | fixed |
| sibling_count4 | -0.03661 | 0.02457 | -1.49 | -0.08477 | 0.01156 | fixed |
| sibling_count5 | -0.009323 | 0.02638 | -0.3534 | -0.06102 | 0.04238 | fixed |
| sibling_count5+ | 0.02623 | 0.02589 | 1.013 | -0.02451 | 0.07696 | fixed |
| sd_(Intercept).mother_pidlink | 0.1587 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3721 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9044 | 0.2607 | 3.47 | 0.3935 | 1.415 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1011 | 0.02801 | -3.608 | -0.156 | -0.04616 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.003996 | 0.0009609 | 4.159 | 0.002113 | 0.00588 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004462 | 0.00001055 | -4.229 | -0.00006531 | -0.00002394 | fixed |
| male | -0.02403 | 0.01312 | -1.832 | -0.04974 | 0.001677 | fixed |
| sibling_count3 | -0.01015 | 0.02454 | -0.4134 | -0.05824 | 0.03795 | fixed |
| sibling_count4 | -0.03844 | 0.02528 | -1.521 | -0.08799 | 0.0111 | fixed |
| sibling_count5 | -0.008874 | 0.02749 | -0.3228 | -0.06275 | 0.04501 | fixed |
| sibling_count5+ | 0.02904 | 0.02661 | 1.091 | -0.02311 | 0.08119 | fixed |
| birth_order_nonlinear2 | 0.01753 | 0.01751 | 1.001 | -0.01679 | 0.05185 | fixed |
| birth_order_nonlinear3 | 0.01558 | 0.02045 | 0.7616 | -0.02451 | 0.05566 | fixed |
| birth_order_nonlinear4 | -0.00005852 | 0.0242 | -0.002418 | -0.04749 | 0.04737 | fixed |
| birth_order_nonlinear5 | -0.002062 | 0.02949 | -0.06994 | -0.05986 | 0.05573 | fixed |
| birth_order_nonlinear5+ | 0.002764 | 0.02752 | 0.1004 | -0.05118 | 0.05671 | fixed |
| sd_(Intercept).mother_pidlink | 0.1585 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3722 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.904 | 0.2612 | 3.46 | 0.392 | 1.416 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1033 | 0.02807 | -3.68 | -0.1583 | -0.04828 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.004077 | 0.0009634 | 4.233 | 0.002189 | 0.005966 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004555 | 0.00001058 | -4.305 | -0.00006629 | -0.00002481 | fixed |
| male | -0.02482 | 0.01313 | -1.89 | -0.05057 | 0.0009199 | fixed |
| count_birth_order2/2 | 0.07947 | 0.03699 | 2.148 | 0.006965 | 0.152 | fixed |
| count_birth_order1/3 | 0.02032 | 0.0316 | 0.643 | -0.04161 | 0.08225 | fixed |
| count_birth_order2/3 | 0.04303 | 0.03437 | 1.252 | -0.02433 | 0.1104 | fixed |
| count_birth_order3/3 | -0.015 | 0.03778 | -0.3971 | -0.08904 | 0.05904 | fixed |
| count_birth_order1/4 | 0.005795 | 0.03435 | 0.1687 | -0.06153 | 0.07312 | fixed |
| count_birth_order2/4 | -0.0307 | 0.03584 | -0.8566 | -0.1009 | 0.03954 | fixed |
| count_birth_order3/4 | -0.0108 | 0.03917 | -0.2758 | -0.08757 | 0.06596 | fixed |
| count_birth_order4/4 | -0.006404 | 0.04181 | -0.1532 | -0.08835 | 0.07554 | fixed |
| count_birth_order1/5 | 0.01609 | 0.04117 | 0.3908 | -0.0646 | 0.09678 | fixed |
| count_birth_order2/5 | 0.01692 | 0.04276 | 0.3957 | -0.06688 | 0.1007 | fixed |
| count_birth_order3/5 | 0.01622 | 0.04352 | 0.3728 | -0.06907 | 0.1015 | fixed |
| count_birth_order4/5 | 0.01776 | 0.04424 | 0.4013 | -0.06896 | 0.1045 | fixed |
| count_birth_order5/5 | 0.02105 | 0.04457 | 0.4723 | -0.0663 | 0.1084 | fixed |
| count_birth_order1/5+ | 0.03557 | 0.03723 | 0.9554 | -0.0374 | 0.1085 | fixed |
| count_birth_order2/5+ | 0.04765 | 0.03933 | 1.211 | -0.02944 | 0.1247 | fixed |
| count_birth_order3/5+ | 0.1171 | 0.03789 | 3.092 | 0.04288 | 0.1914 | fixed |
| count_birth_order4/5+ | 0.03739 | 0.03695 | 1.012 | -0.03504 | 0.1098 | fixed |
| count_birth_order5/5+ | 0.03913 | 0.03908 | 1.001 | -0.03746 | 0.1157 | fixed |
| count_birth_order5+/5+ | 0.05174 | 0.02961 | 1.747 | -0.006299 | 0.1098 | fixed |
| sd_(Intercept).mother_pidlink | 0.1582 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3723 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 3939 | 4008 | -1958 | 3917 | NA | NA | NA |
| 12 | 3941 | 4016 | -1958 | 3917 | 0.01549 | 1 | 0.901 |
| 16 | 3947 | 4047 | -1958 | 3915 | 1.543 | 4 | 0.8189 |
| 26 | 3955 | 4118 | -1952 | 3903 | 11.8 | 10 | 0.2988 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9712 | 0.2646 | 3.67 | 0.4525 | 1.49 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.11 | 0.02846 | -3.864 | -0.1657 | -0.05418 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.004334 | 0.0009771 | 4.435 | 0.002418 | 0.006249 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004871 | 0.00001074 | -4.536 | -0.00006976 | -0.00002766 | fixed |
| male | -0.02276 | 0.0133 | -1.711 | -0.04883 | 0.003314 | fixed |
| sibling_count3 | 0.02252 | 0.02157 | 1.044 | -0.01976 | 0.06479 | fixed |
| sibling_count4 | -0.02657 | 0.02265 | -1.173 | -0.07097 | 0.01783 | fixed |
| sibling_count5 | 0.03133 | 0.02594 | 1.208 | -0.01952 | 0.08218 | fixed |
| sibling_count5+ | 0.04105 | 0.02217 | 1.852 | -0.002396 | 0.0845 | fixed |
| sd_(Intercept).mother_pidlink | 0.16 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3726 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9698 | 0.2647 | 3.663 | 0.4509 | 1.489 | fixed |
| birth_order | -0.001067 | 0.004238 | -0.2517 | -0.009373 | 0.007239 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1097 | 0.02848 | -3.851 | -0.1655 | -0.05385 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.004326 | 0.0009776 | 4.425 | 0.00241 | 0.006242 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004867 | 0.00001074 | -4.531 | -0.00006973 | -0.00002762 | fixed |
| male | -0.02275 | 0.0133 | -1.71 | -0.04882 | 0.00333 | fixed |
| sibling_count3 | 0.02308 | 0.02169 | 1.064 | -0.01943 | 0.0656 | fixed |
| sibling_count4 | -0.02539 | 0.02314 | -1.097 | -0.07074 | 0.01996 | fixed |
| sibling_count5 | 0.03322 | 0.02704 | 1.229 | -0.01977 | 0.08622 | fixed |
| sibling_count5+ | 0.0449 | 0.02695 | 1.666 | -0.007923 | 0.09772 | fixed |
| sd_(Intercept).mother_pidlink | 0.1602 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3725 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9616 | 0.2651 | 3.628 | 0.4421 | 1.481 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1091 | 0.0285 | -3.828 | -0.165 | -0.05323 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00431 | 0.0009784 | 4.405 | 0.002392 | 0.006227 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004859 | 0.00001075 | -4.519 | -0.00006966 | -0.00002751 | fixed |
| male | -0.02281 | 0.01331 | -1.713 | -0.0489 | 0.003284 | fixed |
| sibling_count3 | 0.02313 | 0.02213 | 1.045 | -0.02025 | 0.06651 | fixed |
| sibling_count4 | -0.02585 | 0.02394 | -1.08 | -0.07278 | 0.02107 | fixed |
| sibling_count5 | 0.03196 | 0.02818 | 1.134 | -0.02328 | 0.08719 | fixed |
| sibling_count5+ | 0.05248 | 0.02768 | 1.896 | -0.001773 | 0.1067 | fixed |
| birth_order_nonlinear2 | 0.004606 | 0.01724 | 0.2672 | -0.02918 | 0.03839 | fixed |
| birth_order_nonlinear3 | -0.001029 | 0.02041 | -0.0504 | -0.04103 | 0.03897 | fixed |
| birth_order_nonlinear4 | 0.001722 | 0.02559 | 0.06727 | -0.04844 | 0.05189 | fixed |
| birth_order_nonlinear5 | 0.003465 | 0.03152 | 0.1099 | -0.05832 | 0.06525 | fixed |
| birth_order_nonlinear5+ | -0.02943 | 0.03147 | -0.9352 | -0.09112 | 0.03225 | fixed |
| sd_(Intercept).mother_pidlink | 0.1602 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3727 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.9503 | 0.266 | 3.573 | 0.429 | 1.472 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.1092 | 0.0286 | -3.819 | -0.1653 | -0.05318 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.004316 | 0.0009823 | 4.394 | 0.002391 | 0.006241 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00004867 | 0.0000108 | -4.507 | -0.00006983 | -0.00002751 | fixed |
| male | -0.0234 | 0.01334 | -1.754 | -0.04954 | 0.002743 | fixed |
| count_birth_order2/2 | 0.0426 | 0.03271 | 1.302 | -0.02152 | 0.1067 | fixed |
| count_birth_order1/3 | 0.04535 | 0.0282 | 1.608 | -0.009916 | 0.1006 | fixed |
| count_birth_order2/3 | 0.04406 | 0.03134 | 1.406 | -0.01736 | 0.1055 | fixed |
| count_birth_order3/3 | 0.01164 | 0.03353 | 0.3472 | -0.05408 | 0.07737 | fixed |
| count_birth_order1/4 | -0.008358 | 0.03305 | -0.2528 | -0.07314 | 0.05643 | fixed |
| count_birth_order2/4 | -0.04096 | 0.03452 | -1.187 | -0.1086 | 0.0267 | fixed |
| count_birth_order3/4 | -0.01007 | 0.03618 | -0.2784 | -0.08097 | 0.06083 | fixed |
| count_birth_order4/4 | 0.02124 | 0.03901 | 0.5443 | -0.05522 | 0.09769 | fixed |
| count_birth_order1/5 | 0.0574 | 0.04322 | 1.328 | -0.02731 | 0.1421 | fixed |
| count_birth_order2/5 | 0.07243 | 0.04845 | 1.495 | -0.02254 | 0.1674 | fixed |
| count_birth_order3/5 | 0.0487 | 0.04642 | 1.049 | -0.04227 | 0.1397 | fixed |
| count_birth_order4/5 | 0.03821 | 0.04477 | 0.8534 | -0.04954 | 0.126 | fixed |
| count_birth_order5/5 | 0.0122 | 0.04712 | 0.2589 | -0.08016 | 0.1046 | fixed |
| count_birth_order1/5+ | 0.05652 | 0.0421 | 1.342 | -0.026 | 0.139 | fixed |
| count_birth_order2/5+ | 0.05222 | 0.04261 | 1.225 | -0.0313 | 0.1357 | fixed |
| count_birth_order3/5+ | 0.09224 | 0.04079 | 2.261 | 0.01228 | 0.1722 | fixed |
| count_birth_order4/5+ | 0.03775 | 0.04057 | 0.9304 | -0.04177 | 0.1173 | fixed |
| count_birth_order5/5+ | 0.0893 | 0.0384 | 2.326 | 0.01404 | 0.1646 | fixed |
| count_birth_order5+/5+ | 0.0354 | 0.0301 | 1.176 | -0.02359 | 0.09438 | fixed |
| sd_(Intercept).mother_pidlink | 0.1598 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3729 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 3861 | 3930 | -1919 | 3839 | NA | NA | NA |
| 12 | 3863 | 3938 | -1919 | 3839 | 0.06169 | 1 | 0.8038 |
| 16 | 3870 | 3969 | -1919 | 3838 | 1.332 | 4 | 0.856 |
| 26 | 3882 | 4044 | -1915 | 3830 | 8.08 | 10 | 0.6211 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = `Category_Unpaid family worker`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.174 | 0.06645 | 17.66 | 1.044 | 1.304 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.0784 | 0.005963 | -13.15 | -0.09008 | -0.06671 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001808 | 0.0001676 | 10.79 | 0.001479 | 0.002136 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001311 | 0.00000149 | -8.799 | -0.00001603 | -0.00001019 | fixed |
| male | -0.09204 | 0.006103 | -15.08 | -0.104 | -0.08008 | fixed |
| sibling_count3 | 0.01356 | 0.0129 | 1.051 | -0.01173 | 0.03885 | fixed |
| sibling_count4 | 0.01864 | 0.01303 | 1.43 | -0.006901 | 0.04417 | fixed |
| sibling_count5 | 0.02536 | 0.0136 | 1.865 | -0.001285 | 0.05201 | fixed |
| sibling_count5+ | 0.04657 | 0.01052 | 4.427 | 0.02595 | 0.06718 | fixed |
| sd_(Intercept).mother_pidlink | 0.1222 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2808 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.173 | 0.06645 | 17.66 | 1.043 | 1.303 | fixed |
| birth_order | 0.002099 | 0.001252 | 1.676 | -0.000355 | 0.004553 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.07898 | 0.005973 | -13.22 | -0.09069 | -0.06727 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00183 | 0.0001681 | 10.89 | 0.0015 | 0.002159 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001331 | 0.000001494 | -8.905 | -0.00001624 | -0.00001038 | fixed |
| male | -0.09207 | 0.006102 | -15.09 | -0.104 | -0.08011 | fixed |
| sibling_count3 | 0.01303 | 0.01291 | 1.009 | -0.01227 | 0.03832 | fixed |
| sibling_count4 | 0.0174 | 0.01305 | 1.333 | -0.00818 | 0.04298 | fixed |
| sibling_count5 | 0.02316 | 0.01366 | 1.695 | -0.003617 | 0.04993 | fixed |
| sibling_count5+ | 0.03929 | 0.01138 | 3.453 | 0.01699 | 0.06159 | fixed |
| sd_(Intercept).mother_pidlink | 0.1223 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2807 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.178 | 0.06653 | 17.71 | 1.048 | 1.309 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.07952 | 0.005977 | -13.3 | -0.09123 | -0.0678 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001839 | 0.0001681 | 10.94 | 0.00151 | 0.002169 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001332 | 0.000001495 | -8.914 | -0.00001625 | -0.00001039 | fixed |
| male | -0.09203 | 0.006102 | -15.08 | -0.104 | -0.08007 | fixed |
| sibling_count3 | 0.008595 | 0.01308 | 0.657 | -0.01704 | 0.03423 | fixed |
| sibling_count4 | 0.01064 | 0.01338 | 0.7952 | -0.01558 | 0.03685 | fixed |
| sibling_count5 | 0.01522 | 0.01409 | 1.08 | -0.0124 | 0.04285 | fixed |
| sibling_count5+ | 0.0316 | 0.01189 | 2.658 | 0.008295 | 0.0549 | fixed |
| birth_order_nonlinear2 | 0.01122 | 0.008852 | 1.268 | -0.006126 | 0.02858 | fixed |
| birth_order_nonlinear3 | 0.02609 | 0.01028 | 2.537 | 0.005937 | 0.04624 | fixed |
| birth_order_nonlinear4 | 0.02517 | 0.01155 | 2.179 | 0.002532 | 0.0478 | fixed |
| birth_order_nonlinear5 | 0.02458 | 0.01299 | 1.892 | -0.0008849 | 0.05005 | fixed |
| birth_order_nonlinear5+ | 0.0255 | 0.01086 | 2.347 | 0.004204 | 0.04679 | fixed |
| sd_(Intercept).mother_pidlink | 0.122 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2808 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 1.183 | 0.06675 | 17.73 | 1.053 | 1.314 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.08008 | 0.005981 | -13.39 | -0.09181 | -0.06836 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00185 | 0.0001682 | 11 | 0.001521 | 0.00218 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001336 | 0.000001495 | -8.938 | -0.0000163 | -0.00001043 | fixed |
| male | -0.09221 | 0.006105 | -15.1 | -0.1042 | -0.08024 | fixed |
| count_birth_order2/2 | 0.01891 | 0.01758 | 1.076 | -0.01555 | 0.05337 | fixed |
| count_birth_order1/3 | 0.001989 | 0.01717 | 0.1158 | -0.03166 | 0.03564 | fixed |
| count_birth_order2/3 | 0.01413 | 0.01902 | 0.7428 | -0.02315 | 0.0514 | fixed |
| count_birth_order3/3 | 0.06725 | 0.02087 | 3.222 | 0.02634 | 0.1082 | fixed |
| count_birth_order1/4 | 0.01351 | 0.01879 | 0.7191 | -0.02332 | 0.05035 | fixed |
| count_birth_order2/4 | 0.0194 | 0.02014 | 0.9631 | -0.02008 | 0.05888 | fixed |
| count_birth_order3/4 | 0.02846 | 0.02147 | 1.326 | -0.01361 | 0.07054 | fixed |
| count_birth_order4/4 | 0.06085 | 0.0228 | 2.67 | 0.01618 | 0.1055 | fixed |
| count_birth_order1/5 | 0.0184 | 0.02132 | 0.8626 | -0.0234 | 0.06019 | fixed |
| count_birth_order2/5 | 0.04596 | 0.02261 | 2.033 | 0.001651 | 0.09026 | fixed |
| count_birth_order3/5 | 0.02026 | 0.02379 | 0.8517 | -0.02636 | 0.06689 | fixed |
| count_birth_order4/5 | 0.0333 | 0.02499 | 1.333 | -0.01567 | 0.08228 | fixed |
| count_birth_order5/5 | 0.059 | 0.02499 | 2.361 | 0.01001 | 0.108 | fixed |
| count_birth_order1/5+ | 0.04611 | 0.01642 | 2.809 | 0.01393 | 0.07828 | fixed |
| count_birth_order2/5+ | 0.04523 | 0.01709 | 2.647 | 0.01174 | 0.07873 | fixed |
| count_birth_order3/5+ | 0.0602 | 0.01683 | 3.576 | 0.0272 | 0.09319 | fixed |
| count_birth_order4/5+ | 0.05521 | 0.01654 | 3.338 | 0.02279 | 0.08762 | fixed |
| count_birth_order5/5+ | 0.05467 | 0.01672 | 3.27 | 0.0219 | 0.08743 | fixed |
| count_birth_order5+/5+ | 0.06034 | 0.01362 | 4.429 | 0.03364 | 0.08704 | fixed |
| sd_(Intercept).mother_pidlink | 0.1218 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2808 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 4606 | 4686 | -2292 | 4584 | NA | NA | NA |
| 12 | 4605 | 4692 | -2291 | 4581 | 2.811 | 1 | 0.09361 |
| 16 | 4607 | 4722 | -2287 | 4575 | 6.69 | 4 | 0.1532 |
| 26 | 4616 | 4804 | -2282 | 4564 | 10.22 | 10 | 0.4212 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.442 | 0.188 | 12.99 | 2.074 | 2.81 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.2215 | 0.02019 | -10.97 | -0.2611 | -0.1819 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.006628 | 0.0006926 | 9.57 | 0.00527 | 0.007985 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00006461 | 0.000007603 | -8.497 | -0.00007951 | -0.00004971 | fixed |
| male | -0.03876 | 0.009466 | -4.095 | -0.05731 | -0.02021 | fixed |
| sibling_count3 | 0.02684 | 0.01573 | 1.706 | -0.003987 | 0.05766 | fixed |
| sibling_count4 | 0.05053 | 0.01628 | 3.105 | 0.01863 | 0.08243 | fixed |
| sibling_count5 | 0.05469 | 0.01812 | 3.018 | 0.01918 | 0.0902 | fixed |
| sibling_count5+ | 0.07393 | 0.01574 | 4.699 | 0.04309 | 0.1048 | fixed |
| sd_(Intercept).mother_pidlink | 0.1072 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2701 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.445 | 0.188 | 13 | 2.076 | 2.813 | fixed |
| birth_order | 0.003024 | 0.002952 | 1.024 | -0.002762 | 0.008809 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.2222 | 0.0202 | -11 | -0.2617 | -0.1826 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.006644 | 0.0006927 | 9.591 | 0.005286 | 0.008002 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00006465 | 0.000007603 | -8.503 | -0.00007956 | -0.00004975 | fixed |
| male | -0.03886 | 0.009466 | -4.105 | -0.05741 | -0.02031 | fixed |
| sibling_count3 | 0.02528 | 0.0158 | 1.6 | -0.005696 | 0.05626 | fixed |
| sibling_count4 | 0.04716 | 0.01661 | 2.839 | 0.0146 | 0.07971 | fixed |
| sibling_count5 | 0.04914 | 0.01892 | 2.598 | 0.01206 | 0.08622 | fixed |
| sibling_count5+ | 0.06302 | 0.01901 | 3.315 | 0.02577 | 0.1003 | fixed |
| sd_(Intercept).mother_pidlink | 0.1075 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.27 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.444 | 0.1882 | 12.99 | 2.075 | 2.813 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.222 | 0.0202 | -10.99 | -0.2616 | -0.1824 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.006638 | 0.000693 | 9.578 | 0.005279 | 0.007996 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00006456 | 0.000007608 | -8.486 | -0.00007948 | -0.00004965 | fixed |
| male | -0.03863 | 0.009467 | -4.08 | -0.05718 | -0.02007 | fixed |
| sibling_count3 | 0.01909 | 0.0161 | 1.186 | -0.01247 | 0.05065 | fixed |
| sibling_count4 | 0.03957 | 0.01718 | 2.303 | 0.005902 | 0.07325 | fixed |
| sibling_count5 | 0.0444 | 0.01979 | 2.244 | 0.005624 | 0.08318 | fixed |
| sibling_count5+ | 0.05921 | 0.01949 | 3.038 | 0.02101 | 0.09741 | fixed |
| birth_order_nonlinear2 | 0.01273 | 0.01246 | 1.022 | -0.01169 | 0.03714 | fixed |
| birth_order_nonlinear3 | 0.03267 | 0.01466 | 2.229 | 0.003941 | 0.0614 | fixed |
| birth_order_nonlinear4 | 0.02027 | 0.01786 | 1.135 | -0.01474 | 0.05528 | fixed |
| birth_order_nonlinear5 | 0.004018 | 0.02197 | 0.1828 | -0.03905 | 0.04708 | fixed |
| birth_order_nonlinear5+ | 0.02633 | 0.02188 | 1.203 | -0.01656 | 0.06922 | fixed |
| sd_(Intercept).mother_pidlink | 0.107 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2701 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.448 | 0.1889 | 12.96 | 2.078 | 2.819 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.2223 | 0.02028 | -10.96 | -0.2621 | -0.1826 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.006654 | 0.0006958 | 9.563 | 0.00529 | 0.008018 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00006481 | 0.00000764 | -8.483 | -0.00007979 | -0.00004984 | fixed |
| male | -0.03842 | 0.00948 | -4.053 | -0.057 | -0.01984 | fixed |
| count_birth_order2/2 | 0.003413 | 0.02421 | 0.141 | -0.04403 | 0.05086 | fixed |
| count_birth_order1/3 | 0.0001465 | 0.02055 | 0.007127 | -0.04013 | 0.04043 | fixed |
| count_birth_order2/3 | 0.03307 | 0.02282 | 1.449 | -0.01166 | 0.0778 | fixed |
| count_birth_order3/3 | 0.07378 | 0.02468 | 2.99 | 0.02541 | 0.1222 | fixed |
| count_birth_order1/4 | 0.05301 | 0.0236 | 2.246 | 0.006748 | 0.09927 | fixed |
| count_birth_order2/4 | 0.03648 | 0.02481 | 1.47 | -0.01216 | 0.08511 | fixed |
| count_birth_order3/4 | 0.04578 | 0.02602 | 1.759 | -0.005222 | 0.09678 | fixed |
| count_birth_order4/4 | 0.07534 | 0.0276 | 2.73 | 0.02124 | 0.1294 | fixed |
| count_birth_order1/5 | 0.03696 | 0.03096 | 1.194 | -0.02371 | 0.09764 | fixed |
| count_birth_order2/5 | 0.09427 | 0.03368 | 2.799 | 0.02825 | 0.1603 | fixed |
| count_birth_order3/5 | 0.05057 | 0.03156 | 1.602 | -0.01129 | 0.1124 | fixed |
| count_birth_order4/5 | 0.0572 | 0.0307 | 1.863 | -0.002967 | 0.1174 | fixed |
| count_birth_order5/5 | 0.04417 | 0.03219 | 1.372 | -0.01891 | 0.1073 | fixed |
| count_birth_order1/5+ | 0.06705 | 0.02944 | 2.278 | 0.009357 | 0.1248 | fixed |
| count_birth_order2/5+ | 0.06292 | 0.0297 | 2.118 | 0.004706 | 0.1211 | fixed |
| count_birth_order3/5+ | 0.101 | 0.02904 | 3.479 | 0.0441 | 0.1579 | fixed |
| count_birth_order4/5+ | 0.06068 | 0.0282 | 2.152 | 0.005407 | 0.116 | fixed |
| count_birth_order5/5+ | 0.06101 | 0.0272 | 2.243 | 0.007709 | 0.1143 | fixed |
| count_birth_order5+/5+ | 0.08233 | 0.02124 | 3.876 | 0.04071 | 0.124 | fixed |
| sd_(Intercept).mother_pidlink | 0.107 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2701 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 1386 | 1455 | -682.2 | 1364 | NA | NA | NA |
| 12 | 1387 | 1462 | -681.6 | 1363 | 1.048 | 1 | 0.3059 |
| 16 | 1390 | 1490 | -679.2 | 1358 | 4.901 | 4 | 0.2976 |
| 26 | 1401 | 1563 | -674.3 | 1349 | 9.699 | 10 | 0.4672 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.464 | 0.1878 | 13.13 | 2.096 | 2.832 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.2235 | 0.02018 | -11.07 | -0.263 | -0.1839 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00669 | 0.0006925 | 9.661 | 0.005332 | 0.008047 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000652 | 0.000007604 | -8.574 | -0.0000801 | -0.00005029 | fixed |
| male | -0.03937 | 0.009461 | -4.161 | -0.05792 | -0.02083 | fixed |
| sibling_count3 | 0.02618 | 0.01729 | 1.514 | -0.007704 | 0.06007 | fixed |
| sibling_count4 | 0.0433 | 0.01744 | 2.482 | 0.009104 | 0.07749 | fixed |
| sibling_count5 | 0.03684 | 0.01841 | 2.001 | 0.0007636 | 0.07291 | fixed |
| sibling_count5+ | 0.06644 | 0.01613 | 4.12 | 0.03483 | 0.09805 | fixed |
| sd_(Intercept).mother_pidlink | 0.1083 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2705 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.468 | 0.1877 | 13.14 | 2.1 | 2.835 | fixed |
| birth_order | 0.004248 | 0.002612 | 1.626 | -0.0008725 | 0.009368 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.2243 | 0.02018 | -11.11 | -0.2639 | -0.1848 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00671 | 0.0006924 | 9.691 | 0.005353 | 0.008067 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00006523 | 0.000007602 | -8.581 | -0.00008013 | -0.00005033 | fixed |
| male | -0.03948 | 0.009459 | -4.174 | -0.05802 | -0.02094 | fixed |
| sibling_count3 | 0.02393 | 0.01734 | 1.38 | -0.01007 | 0.05792 | fixed |
| sibling_count4 | 0.03886 | 0.01766 | 2.201 | 0.00425 | 0.07346 | fixed |
| sibling_count5 | 0.02956 | 0.01894 | 1.561 | -0.007566 | 0.06669 | fixed |
| sibling_count5+ | 0.05138 | 0.0186 | 2.763 | 0.01494 | 0.08783 | fixed |
| sd_(Intercept).mother_pidlink | 0.1085 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2704 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.458 | 0.1878 | 13.09 | 2.09 | 2.827 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.2232 | 0.02018 | -11.06 | -0.2627 | -0.1836 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.006673 | 0.0006925 | 9.636 | 0.005316 | 0.00803 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00006486 | 0.000007605 | -8.528 | -0.00007976 | -0.00004995 | fixed |
| male | -0.03913 | 0.009457 | -4.137 | -0.05766 | -0.02059 | fixed |
| sibling_count3 | 0.01657 | 0.01763 | 0.9395 | -0.018 | 0.05113 | fixed |
| sibling_count4 | 0.0298 | 0.01816 | 1.641 | -0.005797 | 0.0654 | fixed |
| sibling_count5 | 0.02269 | 0.01975 | 1.149 | -0.01601 | 0.0614 | fixed |
| sibling_count5+ | 0.04598 | 0.01911 | 2.406 | 0.008519 | 0.08344 | fixed |
| birth_order_nonlinear2 | 0.01053 | 0.01265 | 0.8323 | -0.01426 | 0.03531 | fixed |
| birth_order_nonlinear3 | 0.03994 | 0.01477 | 2.705 | 0.011 | 0.06888 | fixed |
| birth_order_nonlinear4 | 0.02845 | 0.01747 | 1.629 | -0.00579 | 0.06269 | fixed |
| birth_order_nonlinear5 | 0.009549 | 0.02128 | 0.4487 | -0.03217 | 0.05127 | fixed |
| birth_order_nonlinear5+ | 0.03222 | 0.01982 | 1.625 | -0.006636 | 0.07107 | fixed |
| sd_(Intercept).mother_pidlink | 0.1088 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2702 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.444 | 0.1881 | 12.99 | 2.075 | 2.813 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.2221 | 0.02022 | -10.99 | -0.2617 | -0.1825 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00664 | 0.0006938 | 9.571 | 0.005281 | 0.008 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00006454 | 0.000007622 | -8.468 | -0.00007948 | -0.00004961 | fixed |
| male | -0.03836 | 0.009465 | -4.052 | -0.05691 | -0.01981 | fixed |
| count_birth_order2/2 | 0.02215 | 0.02669 | 0.83 | -0.03016 | 0.07447 | fixed |
| count_birth_order1/3 | 0.00529 | 0.02274 | 0.2326 | -0.03928 | 0.04986 | fixed |
| count_birth_order2/3 | 0.02414 | 0.02474 | 0.9755 | -0.02436 | 0.07263 | fixed |
| count_birth_order3/3 | 0.09777 | 0.0272 | 3.594 | 0.04445 | 0.1511 | fixed |
| count_birth_order1/4 | 0.05529 | 0.02473 | 2.236 | 0.006829 | 0.1038 | fixed |
| count_birth_order2/4 | 0.01373 | 0.0258 | 0.5321 | -0.03684 | 0.0643 | fixed |
| count_birth_order3/4 | 0.06335 | 0.02821 | 2.246 | 0.008066 | 0.1186 | fixed |
| count_birth_order4/4 | 0.08211 | 0.03012 | 2.727 | 0.02309 | 0.1411 | fixed |
| count_birth_order1/5 | 0.001284 | 0.02964 | 0.04333 | -0.05681 | 0.05938 | fixed |
| count_birth_order2/5 | 0.08761 | 0.03079 | 2.845 | 0.02726 | 0.148 | fixed |
| count_birth_order3/5 | 0.05313 | 0.03135 | 1.695 | -0.008308 | 0.1146 | fixed |
| count_birth_order4/5 | 0.05656 | 0.03187 | 1.775 | -0.005906 | 0.119 | fixed |
| count_birth_order5/5 | 0.02284 | 0.03211 | 0.7115 | -0.04008 | 0.08577 | fixed |
| count_birth_order1/5+ | 0.07247 | 0.0268 | 2.704 | 0.01993 | 0.125 | fixed |
| count_birth_order2/5+ | 0.06204 | 0.02833 | 2.19 | 0.006505 | 0.1176 | fixed |
| count_birth_order3/5+ | 0.07122 | 0.02729 | 2.61 | 0.01773 | 0.1247 | fixed |
| count_birth_order4/5+ | 0.06325 | 0.02662 | 2.376 | 0.01108 | 0.1154 | fixed |
| count_birth_order5/5+ | 0.06806 | 0.02816 | 2.417 | 0.01288 | 0.1232 | fixed |
| count_birth_order5+/5+ | 0.08184 | 0.02129 | 3.844 | 0.04011 | 0.1236 | fixed |
| sd_(Intercept).mother_pidlink | 0.1072 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2705 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 1418 | 1487 | -697.9 | 1396 | NA | NA | NA |
| 12 | 1417 | 1492 | -696.5 | 1393 | 2.648 | 1 | 0.1037 |
| 16 | 1419 | 1519 | -693.4 | 1387 | 6.263 | 4 | 0.1804 |
| 26 | 1422 | 1585 | -685 | 1370 | 16.78 | 10 | 0.07945 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.439 | 0.1895 | 12.87 | 2.068 | 2.81 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.2205 | 0.02038 | -10.82 | -0.2605 | -0.1806 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.006576 | 0.0006996 | 9.4 | 0.005205 | 0.007948 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00006393 | 0.00000769 | -8.314 | -0.00007901 | -0.00004886 | fixed |
| male | -0.03783 | 0.009531 | -3.97 | -0.05651 | -0.01915 | fixed |
| sibling_count3 | 0.02853 | 0.01537 | 1.857 | -0.001589 | 0.05865 | fixed |
| sibling_count4 | 0.04803 | 0.01613 | 2.978 | 0.01642 | 0.07964 | fixed |
| sibling_count5 | 0.06003 | 0.01844 | 3.255 | 0.02389 | 0.09618 | fixed |
| sibling_count5+ | 0.07782 | 0.01576 | 4.938 | 0.04693 | 0.1087 | fixed |
| sd_(Intercept).mother_pidlink | 0.1061 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2697 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.442 | 0.1895 | 12.89 | 2.071 | 2.814 | fixed |
| birth_order | 0.002716 | 0.003029 | 0.8965 | -0.003222 | 0.008654 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.2212 | 0.02039 | -10.85 | -0.2612 | -0.1812 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.006594 | 0.0006999 | 9.421 | 0.005222 | 0.007966 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00006401 | 0.00000769 | -8.323 | -0.00007908 | -0.00004893 | fixed |
| male | -0.03786 | 0.009531 | -3.972 | -0.05654 | -0.01918 | fixed |
| sibling_count3 | 0.0271 | 0.01545 | 1.754 | -0.003187 | 0.05739 | fixed |
| sibling_count4 | 0.04504 | 0.01647 | 2.735 | 0.01276 | 0.07732 | fixed |
| sibling_count5 | 0.05519 | 0.01922 | 2.871 | 0.01752 | 0.09287 | fixed |
| sibling_count5+ | 0.06803 | 0.01917 | 3.548 | 0.03045 | 0.1056 | fixed |
| sd_(Intercept).mother_pidlink | 0.1063 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2697 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.443 | 0.1897 | 12.88 | 2.071 | 2.815 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.2215 | 0.02039 | -10.86 | -0.2615 | -0.1815 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.006599 | 0.0007002 | 9.425 | 0.005227 | 0.007972 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00006404 | 0.000007695 | -8.322 | -0.00007912 | -0.00004895 | fixed |
| male | -0.03763 | 0.009533 | -3.948 | -0.05632 | -0.01895 | fixed |
| sibling_count3 | 0.02229 | 0.01576 | 1.415 | -0.008594 | 0.05318 | fixed |
| sibling_count4 | 0.03807 | 0.01704 | 2.234 | 0.004672 | 0.07147 | fixed |
| sibling_count5 | 0.05204 | 0.02004 | 2.598 | 0.01277 | 0.09131 | fixed |
| sibling_count5+ | 0.06606 | 0.01968 | 3.356 | 0.02748 | 0.1046 | fixed |
| birth_order_nonlinear2 | 0.01948 | 0.01238 | 1.573 | -0.004787 | 0.04374 | fixed |
| birth_order_nonlinear3 | 0.027 | 0.01465 | 1.843 | -0.001718 | 0.05571 | fixed |
| birth_order_nonlinear4 | 0.02471 | 0.01837 | 1.345 | -0.01129 | 0.06071 | fixed |
| birth_order_nonlinear5 | 0.001399 | 0.02263 | 0.06181 | -0.04295 | 0.04575 | fixed |
| birth_order_nonlinear5+ | 0.02411 | 0.02252 | 1.071 | -0.02002 | 0.06824 | fixed |
| sd_(Intercept).mother_pidlink | 0.1055 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2699 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 2.451 | 0.1904 | 12.87 | 2.078 | 2.824 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.2225 | 0.02047 | -10.87 | -0.2626 | -0.1824 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.006642 | 0.0007031 | 9.448 | 0.005264 | 0.00802 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00006459 | 0.000007729 | -8.357 | -0.00007974 | -0.00004945 | fixed |
| male | -0.03784 | 0.009553 | -3.961 | -0.05656 | -0.01912 | fixed |
| count_birth_order2/2 | 0.01989 | 0.0235 | 0.8465 | -0.02616 | 0.06594 | fixed |
| count_birth_order1/3 | 0.008942 | 0.02016 | 0.4434 | -0.03058 | 0.04846 | fixed |
| count_birth_order2/3 | 0.04507 | 0.02242 | 2.01 | 0.001131 | 0.08902 | fixed |
| count_birth_order3/3 | 0.07044 | 0.024 | 2.935 | 0.02341 | 0.1175 | fixed |
| count_birth_order1/4 | 0.05241 | 0.02364 | 2.217 | 0.006072 | 0.09875 | fixed |
| count_birth_order2/4 | 0.04846 | 0.0247 | 1.962 | 0.00003909 | 0.09688 | fixed |
| count_birth_order3/4 | 0.04797 | 0.02589 | 1.852 | -0.002785 | 0.09872 | fixed |
| count_birth_order4/4 | 0.07353 | 0.02793 | 2.633 | 0.0188 | 0.1283 | fixed |
| count_birth_order1/5 | 0.05752 | 0.03092 | 1.86 | -0.00309 | 0.1181 | fixed |
| count_birth_order2/5 | 0.07077 | 0.0347 | 2.04 | 0.002764 | 0.1388 | fixed |
| count_birth_order3/5 | 0.05268 | 0.03324 | 1.585 | -0.01247 | 0.1178 | fixed |
| count_birth_order4/5 | 0.07725 | 0.03206 | 2.41 | 0.01442 | 0.1401 | fixed |
| count_birth_order5/5 | 0.07412 | 0.03375 | 2.196 | 0.00798 | 0.1403 | fixed |
| count_birth_order1/5+ | 0.07883 | 0.03014 | 2.616 | 0.01977 | 0.1379 | fixed |
| count_birth_order2/5+ | 0.09488 | 0.03051 | 3.11 | 0.03508 | 0.1547 | fixed |
| count_birth_order3/5+ | 0.1004 | 0.02921 | 3.436 | 0.04311 | 0.1576 | fixed |
| count_birth_order4/5+ | 0.07875 | 0.02906 | 2.71 | 0.02179 | 0.1357 | fixed |
| count_birth_order5/5+ | 0.05546 | 0.0275 | 2.017 | 0.001564 | 0.1094 | fixed |
| count_birth_order5+/5+ | 0.09005 | 0.02148 | 4.192 | 0.04795 | 0.1322 | fixed |
| sd_(Intercept).mother_pidlink | 0.1046 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2704 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 1344 | 1413 | -661 | 1322 | NA | NA | NA |
| 12 | 1345 | 1420 | -660.6 | 1321 | 0.8029 | 1 | 0.3702 |
| 16 | 1348 | 1448 | -658.2 | 1316 | 4.708 | 4 | 0.3186 |
| 26 | 1362 | 1524 | -655.2 | 1310 | 6.094 | 10 | 0.8073 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = `Sector_Agriculture, forestry, fishing and hunting`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1306 | 0.0897 | 1.456 | -0.04522 | 0.3064 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.0008862 | 0.008036 | -0.1103 | -0.01664 | 0.01486 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001282 | 0.0002255 | 0.5685 | -0.0003138 | 0.0005702 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001381 | 0.000002002 | -0.6899 | -0.000005305 | 0.000002542 | fixed |
| male | 0.02977 | 0.008213 | 3.624 | 0.01367 | 0.04586 | fixed |
| sibling_count3 | 0.00264 | 0.01767 | 0.1494 | -0.032 | 0.03728 | fixed |
| sibling_count4 | 0.0012 | 0.01789 | 0.06708 | -0.03386 | 0.03626 | fixed |
| sibling_count5 | 0.00142 | 0.01864 | 0.07615 | -0.03512 | 0.03796 | fixed |
| sibling_count5+ | 0.01776 | 0.01442 | 1.232 | -0.01051 | 0.04604 | fixed |
| sd_(Intercept).mother_pidlink | 0.1829 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3648 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1302 | 0.0897 | 1.451 | -0.04566 | 0.306 | fixed |
| birth_order | 0.001497 | 0.001692 | 0.8848 | -0.001819 | 0.004812 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.001315 | 0.008051 | -0.1634 | -0.01709 | 0.01446 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001445 | 0.0002262 | 0.6385 | -0.000299 | 0.0005879 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00000153 | 0.000002009 | -0.7617 | -0.000005467 | 0.000002407 | fixed |
| male | 0.02974 | 0.008213 | 3.621 | 0.01364 | 0.04584 | fixed |
| sibling_count3 | 0.0023 | 0.01768 | 0.1301 | -0.03235 | 0.03695 | fixed |
| sibling_count4 | 0.0003682 | 0.01791 | 0.02055 | -0.03474 | 0.03547 | fixed |
| sibling_count5 | -0.00009096 | 0.01872 | -0.004859 | -0.03678 | 0.0366 | fixed |
| sibling_count5+ | 0.01263 | 0.01555 | 0.812 | -0.01785 | 0.0431 | fixed |
| sd_(Intercept).mother_pidlink | 0.1827 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3649 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1386 | 0.08983 | 1.543 | -0.03742 | 0.3147 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.001996 | 0.008057 | -0.2477 | -0.01779 | 0.0138 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001671 | 0.0002264 | 0.7384 | -0.0002765 | 0.0006108 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001733 | 0.00000201 | -0.8621 | -0.000005672 | 0.000002206 | fixed |
| male | 0.02977 | 0.008214 | 3.624 | 0.01367 | 0.04587 | fixed |
| sibling_count3 | 0.002077 | 0.01791 | 0.116 | -0.03302 | 0.03717 | fixed |
| sibling_count4 | -0.003051 | 0.01834 | -0.1663 | -0.039 | 0.0329 | fixed |
| sibling_count5 | -0.00412 | 0.01928 | -0.2137 | -0.04191 | 0.03367 | fixed |
| sibling_count5+ | 0.004782 | 0.01621 | 0.295 | -0.02699 | 0.03656 | fixed |
| birth_order_nonlinear2 | -0.004716 | 0.01189 | -0.3967 | -0.02802 | 0.01858 | fixed |
| birth_order_nonlinear3 | 0.003489 | 0.01378 | 0.2532 | -0.02352 | 0.0305 | fixed |
| birth_order_nonlinear4 | 0.02163 | 0.0155 | 1.396 | -0.008745 | 0.05201 | fixed |
| birth_order_nonlinear5 | 0.0108 | 0.01742 | 0.6202 | -0.02333 | 0.04494 | fixed |
| birth_order_nonlinear5+ | 0.02094 | 0.01463 | 1.431 | -0.007737 | 0.04962 | fixed |
| sd_(Intercept).mother_pidlink | 0.1826 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3649 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1623 | 0.09007 | 1.802 | -0.01423 | 0.3388 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.00313 | 0.008058 | -0.3884 | -0.01892 | 0.01266 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001942 | 0.0002263 | 0.8581 | -0.0002494 | 0.0006378 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001913 | 0.000002009 | -0.9523 | -0.000005851 | 0.000002024 | fixed |
| male | 0.02973 | 0.00821 | 3.622 | 0.01364 | 0.04582 | fixed |
| count_birth_order2/2 | -0.03256 | 0.02366 | -1.376 | -0.07893 | 0.01381 | fixed |
| count_birth_order1/3 | -0.02768 | 0.02327 | -1.19 | -0.07329 | 0.01793 | fixed |
| count_birth_order2/3 | -0.02653 | 0.02583 | -1.027 | -0.07717 | 0.0241 | fixed |
| count_birth_order3/3 | 0.05159 | 0.02831 | 1.822 | -0.003905 | 0.1071 | fixed |
| count_birth_order1/4 | -0.02445 | 0.02556 | -0.9567 | -0.07454 | 0.02564 | fixed |
| count_birth_order2/4 | -0.04134 | 0.02739 | -1.509 | -0.09502 | 0.01234 | fixed |
| count_birth_order3/4 | 0.03614 | 0.02885 | 1.253 | -0.0204 | 0.09268 | fixed |
| count_birth_order4/4 | 0.007561 | 0.03102 | 0.2438 | -0.05323 | 0.06836 | fixed |
| count_birth_order1/5 | -0.01458 | 0.02876 | -0.507 | -0.07096 | 0.04179 | fixed |
| count_birth_order2/5 | -0.001386 | 0.03052 | -0.04544 | -0.06119 | 0.05842 | fixed |
| count_birth_order3/5 | -0.04137 | 0.03206 | -1.29 | -0.1042 | 0.02148 | fixed |
| count_birth_order4/5 | 0.04476 | 0.03378 | 1.325 | -0.02145 | 0.111 | fixed |
| count_birth_order5/5 | -0.02623 | 0.03388 | -0.7743 | -0.09264 | 0.04017 | fixed |
| count_birth_order1/5+ | 0.006506 | 0.02222 | 0.2929 | -0.03704 | 0.05005 | fixed |
| count_birth_order2/5+ | 0.02085 | 0.02307 | 0.9039 | -0.02436 | 0.06606 | fixed |
| count_birth_order3/5+ | -0.04021 | 0.02283 | -1.761 | -0.08495 | 0.004531 | fixed |
| count_birth_order4/5+ | 0.007129 | 0.02239 | 0.3185 | -0.03675 | 0.051 | fixed |
| count_birth_order5/5+ | 0.01262 | 0.02261 | 0.5581 | -0.0317 | 0.05694 | fixed |
| count_birth_order5+/5+ | 0.01603 | 0.01858 | 0.8625 | -0.02039 | 0.05244 | fixed |
| sd_(Intercept).mother_pidlink | 0.1828 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3644 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 9969 | 10049 | -4974 | 9947 | NA | NA | NA |
| 12 | 9971 | 10057 | -4973 | 9947 | 0.7849 | 1 | 0.3756 |
| 16 | 9975 | 10090 | -4972 | 9943 | 3.619 | 4 | 0.4601 |
| 26 | 9966 | 10153 | -4957 | 9914 | 28.92 | 10 | 0.001283 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2048 | 0.2492 | 0.8218 | -0.2836 | 0.6932 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.006416 | 0.02672 | -0.2401 | -0.05878 | 0.04595 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0002029 | 0.0009152 | 0.2217 | -0.001591 | 0.001997 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00000112 | 0.00001003 | -0.1116 | -0.00002078 | 0.00001854 | fixed |
| male | 0.01815 | 0.01255 | 1.446 | -0.006448 | 0.04275 | fixed |
| sibling_count3 | -0.01727 | 0.02117 | -0.8156 | -0.05875 | 0.02422 | fixed |
| sibling_count4 | -0.006193 | 0.02193 | -0.2825 | -0.04917 | 0.03678 | fixed |
| sibling_count5 | 0.005548 | 0.02456 | 0.2259 | -0.04259 | 0.05369 | fixed |
| sibling_count5+ | 0.01615 | 0.02122 | 0.7613 | -0.02543 | 0.05773 | fixed |
| sd_(Intercept).mother_pidlink | 0.1644 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3417 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2093 | 0.2493 | 0.8396 | -0.2793 | 0.6979 | fixed |
| birth_order | 0.003167 | 0.003924 | 0.8071 | -0.004523 | 0.01086 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.007299 | 0.02674 | -0.2729 | -0.05971 | 0.04512 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0002263 | 0.0009157 | 0.2472 | -0.001568 | 0.002021 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001234 | 0.00001003 | -0.123 | -0.0000209 | 0.00001843 | fixed |
| male | 0.01803 | 0.01255 | 1.437 | -0.00657 | 0.04263 | fixed |
| sibling_count3 | -0.01886 | 0.02126 | -0.8871 | -0.06053 | 0.02281 | fixed |
| sibling_count4 | -0.009734 | 0.02236 | -0.4353 | -0.05356 | 0.0341 | fixed |
| sibling_count5 | -0.00025 | 0.02559 | -0.009769 | -0.05041 | 0.04991 | fixed |
| sibling_count5+ | 0.004629 | 0.02557 | 0.181 | -0.04549 | 0.05475 | fixed |
| sd_(Intercept).mother_pidlink | 0.1644 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3417 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2063 | 0.2494 | 0.8274 | -0.2824 | 0.6951 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.007303 | 0.02673 | -0.2732 | -0.05969 | 0.04509 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0002221 | 0.0009154 | 0.2426 | -0.001572 | 0.002016 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001135 | 0.00001003 | -0.1131 | -0.0000208 | 0.00001853 | fixed |
| male | 0.01846 | 0.01255 | 1.471 | -0.006134 | 0.04306 | fixed |
| sibling_count3 | -0.02808 | 0.02162 | -1.299 | -0.07046 | 0.0143 | fixed |
| sibling_count4 | -0.02 | 0.02309 | -0.8659 | -0.06526 | 0.02526 | fixed |
| sibling_count5 | -0.004471 | 0.02665 | -0.1678 | -0.05671 | 0.04777 | fixed |
| sibling_count5+ | -0.002136 | 0.02617 | -0.08163 | -0.05342 | 0.04915 | fixed |
| birth_order_nonlinear2 | 0.02484 | 0.01643 | 1.512 | -0.00737 | 0.05705 | fixed |
| birth_order_nonlinear3 | 0.04716 | 0.01931 | 2.443 | 0.009321 | 0.085 | fixed |
| birth_order_nonlinear4 | 0.02073 | 0.02359 | 0.8784 | -0.02552 | 0.06697 | fixed |
| birth_order_nonlinear5 | -0.005032 | 0.02894 | -0.1739 | -0.06176 | 0.05169 | fixed |
| birth_order_nonlinear5+ | 0.04153 | 0.02893 | 1.435 | -0.01518 | 0.09824 | fixed |
| sd_(Intercept).mother_pidlink | 0.164 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3417 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1737 | 0.2502 | 0.6943 | -0.3167 | 0.6641 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.003514 | 0.02683 | -0.131 | -0.0561 | 0.04907 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00007322 | 0.000919 | 0.07967 | -0.001728 | 0.001874 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000006975 | 0.00001008 | 0.06922 | -0.00001905 | 0.00002045 | fixed |
| male | 0.01881 | 0.01256 | 1.498 | -0.005805 | 0.04343 | fixed |
| count_birth_order2/2 | 0.03164 | 0.03213 | 0.9849 | -0.03133 | 0.09461 | fixed |
| count_birth_order1/3 | -0.007422 | 0.02734 | -0.2715 | -0.06101 | 0.04616 | fixed |
| count_birth_order2/3 | -0.0317 | 0.03035 | -1.045 | -0.09118 | 0.02777 | fixed |
| count_birth_order3/3 | 0.0254 | 0.03301 | 0.7693 | -0.0393 | 0.0901 | fixed |
| count_birth_order1/4 | -0.0155 | 0.03133 | -0.4946 | -0.0769 | 0.04591 | fixed |
| count_birth_order2/4 | 0.009061 | 0.03316 | 0.2732 | -0.05593 | 0.07406 | fixed |
| count_birth_order3/4 | 0.05157 | 0.03435 | 1.501 | -0.01576 | 0.1189 | fixed |
| count_birth_order4/4 | -0.02999 | 0.03675 | -0.8159 | -0.102 | 0.04205 | fixed |
| count_birth_order1/5 | -0.007561 | 0.0412 | -0.1835 | -0.08831 | 0.07319 | fixed |
| count_birth_order2/5 | -0.0012 | 0.04434 | -0.02707 | -0.0881 | 0.0857 | fixed |
| count_birth_order3/5 | 0.04731 | 0.04215 | 1.123 | -0.03529 | 0.1299 | fixed |
| count_birth_order4/5 | 0.05736 | 0.0411 | 1.396 | -0.0232 | 0.1379 | fixed |
| count_birth_order5/5 | -0.02381 | 0.04323 | -0.5508 | -0.1085 | 0.06092 | fixed |
| count_birth_order1/5+ | -0.0458 | 0.03899 | -1.175 | -0.1222 | 0.03062 | fixed |
| count_birth_order2/5+ | 0.09322 | 0.03922 | 2.377 | 0.01634 | 0.1701 | fixed |
| count_birth_order3/5+ | 0.01043 | 0.03826 | 0.2726 | -0.06456 | 0.08543 | fixed |
| count_birth_order4/5+ | 0.02492 | 0.03743 | 0.6657 | -0.04844 | 0.09828 | fixed |
| count_birth_order5/5+ | 0.005131 | 0.03579 | 0.1434 | -0.06502 | 0.07528 | fixed |
| count_birth_order5+/5+ | 0.0424 | 0.02827 | 1.5 | -0.01302 | 0.09782 | fixed |
| sd_(Intercept).mother_pidlink | 0.1621 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3422 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 3263 | 3332 | -1621 | 3241 | NA | NA | NA |
| 12 | 3265 | 3339 | -1620 | 3241 | 0.6535 | 1 | 0.4189 |
| 16 | 3265 | 3364 | -1616 | 3233 | 7.902 | 4 | 0.09525 |
| 26 | 3271 | 3432 | -1609 | 3219 | 14.38 | 10 | 0.1564 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2 | 0.248 | 0.8065 | -0.286 | 0.686 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.005978 | 0.02661 | -0.2246 | -0.05814 | 0.04618 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001901 | 0.0009118 | 0.2085 | -0.001597 | 0.001977 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000009767 | 0.000009998 | -0.09769 | -0.00002057 | 0.00001862 | fixed |
| male | 0.01874 | 0.0125 | 1.499 | -0.005762 | 0.04324 | fixed |
| sibling_count3 | -0.02278 | 0.02317 | -0.9834 | -0.06819 | 0.02262 | fixed |
| sibling_count4 | -0.004367 | 0.02342 | -0.1865 | -0.05027 | 0.04154 | fixed |
| sibling_count5 | 0.004279 | 0.02475 | 0.1729 | -0.04423 | 0.05279 | fixed |
| sibling_count5+ | 0.009765 | 0.02168 | 0.4505 | -0.03272 | 0.05225 | fixed |
| sd_(Intercept).mother_pidlink | 0.1641 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3415 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.2047 | 0.248 | 0.8255 | -0.2814 | 0.6908 | fixed |
| birth_order | 0.003732 | 0.00347 | 1.076 | -0.003069 | 0.01053 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.006952 | 0.02663 | -0.2611 | -0.05914 | 0.04524 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0002152 | 0.0009121 | 0.236 | -0.001572 | 0.002003 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00000108 | 0.000009998 | -0.108 | -0.00002068 | 0.00001852 | fixed |
| male | 0.0186 | 0.0125 | 1.488 | -0.005904 | 0.0431 | fixed |
| sibling_count3 | -0.0247 | 0.02323 | -1.063 | -0.07023 | 0.02084 | fixed |
| sibling_count4 | -0.008205 | 0.02369 | -0.3464 | -0.05464 | 0.03823 | fixed |
| sibling_count5 | -0.002088 | 0.02545 | -0.08207 | -0.05196 | 0.04778 | fixed |
| sibling_count5+ | -0.003568 | 0.02497 | -0.1429 | -0.05251 | 0.04537 | fixed |
| sd_(Intercept).mother_pidlink | 0.1639 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3416 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.196 | 0.2482 | 0.7895 | -0.2905 | 0.6824 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.006367 | 0.02663 | -0.2391 | -0.05856 | 0.04583 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001927 | 0.0009122 | 0.2113 | -0.001595 | 0.001981 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000008051 | 0.00001 | -0.0805 | -0.00002041 | 0.0000188 | fixed |
| male | 0.01888 | 0.0125 | 1.51 | -0.005619 | 0.04339 | fixed |
| sibling_count3 | -0.03091 | 0.02358 | -1.311 | -0.07713 | 0.0153 | fixed |
| sibling_count4 | -0.01824 | 0.02432 | -0.7502 | -0.0659 | 0.02942 | fixed |
| sibling_count5 | -0.008351 | 0.02645 | -0.3157 | -0.0602 | 0.04349 | fixed |
| sibling_count5+ | -0.00879 | 0.02563 | -0.343 | -0.05902 | 0.04144 | fixed |
| birth_order_nonlinear2 | 0.02643 | 0.01663 | 1.589 | -0.006167 | 0.05903 | fixed |
| birth_order_nonlinear3 | 0.03556 | 0.01942 | 1.831 | -0.002503 | 0.07363 | fixed |
| birth_order_nonlinear4 | 0.04224 | 0.02305 | 1.833 | -0.002935 | 0.08741 | fixed |
| birth_order_nonlinear5 | 0.00225 | 0.02807 | 0.08016 | -0.05276 | 0.05726 | fixed |
| birth_order_nonlinear5+ | 0.03512 | 0.02623 | 1.339 | -0.01628 | 0.08652 | fixed |
| sd_(Intercept).mother_pidlink | 0.1636 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3417 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1632 | 0.2485 | 0.6567 | -0.3239 | 0.6503 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.002079 | 0.02667 | -0.07794 | -0.05436 | 0.0502 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00001812 | 0.000914 | 0.01983 | -0.001773 | 0.00181 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000001353 | 0.00001002 | 0.135 | -0.00001829 | 0.000021 | fixed |
| male | 0.01964 | 0.01251 | 1.57 | -0.004879 | 0.04415 | fixed |
| count_birth_order2/2 | 0.02775 | 0.03526 | 0.7871 | -0.04135 | 0.09686 | fixed |
| count_birth_order1/3 | -0.01368 | 0.03019 | -0.453 | -0.07286 | 0.0455 | fixed |
| count_birth_order2/3 | -0.02855 | 0.03284 | -0.8694 | -0.09292 | 0.03582 | fixed |
| count_birth_order3/3 | 0.007524 | 0.03635 | 0.207 | -0.06372 | 0.07877 | fixed |
| count_birth_order1/4 | -0.02249 | 0.03274 | -0.6868 | -0.08666 | 0.04169 | fixed |
| count_birth_order2/4 | -0.01115 | 0.03446 | -0.3235 | -0.07868 | 0.05639 | fixed |
| count_birth_order3/4 | 0.08672 | 0.03724 | 2.328 | 0.01372 | 0.1597 | fixed |
| count_birth_order4/4 | -0.01743 | 0.04042 | -0.4312 | -0.09665 | 0.06179 | fixed |
| count_birth_order1/5 | 0.01313 | 0.03952 | 0.3322 | -0.06433 | 0.09059 | fixed |
| count_birth_order2/5 | 0.02348 | 0.04048 | 0.58 | -0.05586 | 0.1028 | fixed |
| count_birth_order3/5 | 0.01464 | 0.0416 | 0.3519 | -0.06689 | 0.09617 | fixed |
| count_birth_order4/5 | 0.04861 | 0.04232 | 1.149 | -0.03434 | 0.1316 | fixed |
| count_birth_order5/5 | -0.036 | 0.04295 | -0.8381 | -0.1202 | 0.04819 | fixed |
| count_birth_order1/5+ | -0.04299 | 0.03567 | -1.205 | -0.1129 | 0.02692 | fixed |
| count_birth_order2/5+ | 0.07643 | 0.03759 | 2.034 | 0.002765 | 0.1501 | fixed |
| count_birth_order3/5+ | -0.02567 | 0.03621 | -0.7089 | -0.09664 | 0.0453 | fixed |
| count_birth_order4/5+ | 0.05458 | 0.03517 | 1.552 | -0.01435 | 0.1235 | fixed |
| count_birth_order5/5+ | 0.0148 | 0.03721 | 0.3979 | -0.05812 | 0.08773 | fixed |
| count_birth_order5+/5+ | 0.0284 | 0.02839 | 1 | -0.02725 | 0.08405 | fixed |
| sd_(Intercept).mother_pidlink | 0.1614 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.342 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 3280 | 3348 | -1629 | 3258 | NA | NA | NA |
| 12 | 3280 | 3355 | -1628 | 3256 | 1.161 | 1 | 0.2813 |
| 16 | 3283 | 3382 | -1625 | 3251 | 5.449 | 4 | 0.2443 |
| 26 | 3282 | 3444 | -1615 | 3230 | 20.81 | 10 | 0.02245 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1848 | 0.2525 | 0.732 | -0.3101 | 0.6797 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.004672 | 0.02712 | -0.1723 | -0.05782 | 0.04848 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001606 | 0.0009297 | 0.1727 | -0.001662 | 0.001983 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000009046 | 0.0000102 | -0.08866 | -0.0000209 | 0.00001909 | fixed |
| male | 0.01747 | 0.01271 | 1.375 | -0.007427 | 0.04238 | fixed |
| sibling_count3 | -0.006028 | 0.0208 | -0.2897 | -0.0468 | 0.03475 | fixed |
| sibling_count4 | -0.008332 | 0.02186 | -0.3811 | -0.05118 | 0.03451 | fixed |
| sibling_count5 | 0.00707 | 0.02522 | 0.2804 | -0.04235 | 0.05649 | fixed |
| sibling_count5+ | 0.01936 | 0.02141 | 0.9043 | -0.02261 | 0.06133 | fixed |
| sd_(Intercept).mother_pidlink | 0.1663 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3423 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1905 | 0.2526 | 0.7539 | -0.3047 | 0.6856 | fixed |
| birth_order | 0.003283 | 0.004052 | 0.81 | -0.00466 | 0.01123 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.005701 | 0.02715 | -0.21 | -0.05891 | 0.04751 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001888 | 0.0009304 | 0.2029 | -0.001635 | 0.002012 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001065 | 0.00001021 | -0.1043 | -0.00002107 | 0.00001894 | fixed |
| male | 0.01743 | 0.01271 | 1.372 | -0.007468 | 0.04234 | fixed |
| sibling_count3 | -0.007723 | 0.02091 | -0.3694 | -0.04871 | 0.03326 | fixed |
| sibling_count4 | -0.01195 | 0.02231 | -0.5356 | -0.05569 | 0.03178 | fixed |
| sibling_count5 | 0.00124 | 0.02622 | 0.04729 | -0.05016 | 0.05264 | fixed |
| sibling_count5+ | 0.007432 | 0.02599 | 0.2859 | -0.04351 | 0.05837 | fixed |
| sd_(Intercept).mother_pidlink | 0.1663 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3424 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1896 | 0.2527 | 0.7506 | -0.3056 | 0.6848 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.006112 | 0.02713 | -0.2253 | -0.05929 | 0.04707 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001968 | 0.0009299 | 0.2116 | -0.001626 | 0.002019 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001088 | 0.0000102 | -0.1067 | -0.00002109 | 0.00001891 | fixed |
| male | 0.01806 | 0.0127 | 1.422 | -0.006835 | 0.04296 | fixed |
| sibling_count3 | -0.01698 | 0.02128 | -0.7977 | -0.05869 | 0.02473 | fixed |
| sibling_count4 | -0.0222 | 0.02304 | -0.9634 | -0.06736 | 0.02296 | fixed |
| sibling_count5 | -0.001415 | 0.0272 | -0.052 | -0.05473 | 0.0519 | fixed |
| sibling_count5+ | 0.001559 | 0.02661 | 0.0586 | -0.0506 | 0.05372 | fixed |
| birth_order_nonlinear2 | 0.03129 | 0.0164 | 1.908 | -0.000851 | 0.06344 | fixed |
| birth_order_nonlinear3 | 0.04782 | 0.01938 | 2.467 | 0.00983 | 0.0858 | fixed |
| birth_order_nonlinear4 | 0.02218 | 0.02437 | 0.9103 | -0.02557 | 0.06994 | fixed |
| birth_order_nonlinear5 | -0.006486 | 0.03001 | -0.2161 | -0.06531 | 0.05234 | fixed |
| birth_order_nonlinear5+ | 0.04426 | 0.02993 | 1.479 | -0.0144 | 0.1029 | fixed |
| sd_(Intercept).mother_pidlink | 0.1653 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3425 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1681 | 0.2535 | 0.663 | -0.3288 | 0.665 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.003336 | 0.02724 | -0.1225 | -0.05672 | 0.05005 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0000858 | 0.0009339 | 0.09188 | -0.001745 | 0.001916 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000002996 | 0.00001025 | 0.02923 | -0.00001979 | 0.00002039 | fixed |
| male | 0.01896 | 0.01272 | 1.49 | -0.005974 | 0.04389 | fixed |
| count_birth_order2/2 | 0.02905 | 0.03134 | 0.9271 | -0.03237 | 0.09047 | fixed |
| count_birth_order1/3 | -0.002032 | 0.02696 | -0.07537 | -0.05487 | 0.05081 | fixed |
| count_birth_order2/3 | -0.007826 | 0.02992 | -0.2615 | -0.06648 | 0.05082 | fixed |
| count_birth_order3/3 | 0.02743 | 0.03219 | 0.8522 | -0.03565 | 0.09051 | fixed |
| count_birth_order1/4 | -0.02844 | 0.03159 | -0.9001 | -0.09036 | 0.03349 | fixed |
| count_birth_order2/4 | 0.01055 | 0.03314 | 0.3183 | -0.0544 | 0.07549 | fixed |
| count_birth_order3/4 | 0.05262 | 0.03435 | 1.532 | -0.01471 | 0.12 | fixed |
| count_birth_order4/4 | -0.02922 | 0.0373 | -0.7834 | -0.1023 | 0.04389 | fixed |
| count_birth_order1/5 | -0.005244 | 0.04125 | -0.1271 | -0.0861 | 0.07561 | fixed |
| count_birth_order2/5 | 0.01438 | 0.04592 | 0.3131 | -0.07563 | 0.1044 | fixed |
| count_birth_order3/5 | 0.03522 | 0.04477 | 0.7867 | -0.05253 | 0.123 | fixed |
| count_birth_order4/5 | 0.06448 | 0.04311 | 1.496 | -0.02001 | 0.149 | fixed |
| count_birth_order5/5 | -0.02928 | 0.04577 | -0.6397 | -0.119 | 0.06042 | fixed |
| count_birth_order1/5+ | -0.03966 | 0.04016 | -0.9875 | -0.1184 | 0.03906 | fixed |
| count_birth_order2/5+ | 0.09011 | 0.04053 | 2.224 | 0.01068 | 0.1695 | fixed |
| count_birth_order3/5+ | 0.02288 | 0.0387 | 0.5913 | -0.05297 | 0.09873 | fixed |
| count_birth_order4/5+ | 0.02081 | 0.03882 | 0.5362 | -0.05527 | 0.09689 | fixed |
| count_birth_order5/5+ | 0.005412 | 0.03647 | 0.1484 | -0.06607 | 0.07689 | fixed |
| count_birth_order5+/5+ | 0.04579 | 0.02876 | 1.592 | -0.01057 | 0.1022 | fixed |
| sd_(Intercept).mother_pidlink | 0.1631 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3434 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 3231 | 3300 | -1605 | 3209 | NA | NA | NA |
| 12 | 3233 | 3307 | -1604 | 3209 | 0.6582 | 1 | 0.4172 |
| 16 | 3232 | 3331 | -1600 | 3200 | 8.947 | 4 | 0.06245 |
| 26 | 3241 | 3402 | -1595 | 3189 | 10.51 | 10 | 0.3971 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = `Sector_Construction`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.00014 | 0.007992 | -0.01751 | -0.0158 | 0.01552 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0001646 | 0.0007143 | 0.2304 | -0.001235 | 0.001565 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.000005987 | 0.00001998 | -0.2997 | -0.00004514 | 0.00003317 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00000005958 | 0.0000001767 | 0.3371 | -0.0000002868 | 0.000000406 | fixed |
| male | 0.001437 | 0.0007496 | 1.917 | -0.00003186 | 0.002907 | fixed |
| sibling_count3 | -0.001779 | 0.001507 | -1.18 | -0.004733 | 0.001175 | fixed |
| sibling_count4 | 0.0006745 | 0.001514 | 0.4455 | -0.002293 | 0.003642 | fixed |
| sibling_count5 | -0.0008865 | 0.001566 | -0.5663 | -0.003955 | 0.002182 | fixed |
| sibling_count5+ | -0.0004652 | 0.001227 | -0.3793 | -0.002869 | 0.001939 | fixed |
| sd_(Intercept).mother_pidlink | 0.000000004242 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.03649 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.0001227 | 0.007992 | -0.01535 | -0.01579 | 0.01554 | fixed |
| birth_order | 0.00008633 | 0.0001468 | 0.5883 | -0.0002013 | 0.000374 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0001414 | 0.0007155 | 0.1976 | -0.001261 | 0.001544 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00000519 | 0.00002002 | -0.2592 | -0.00004443 | 0.00003405 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00000005258 | 0.0000001771 | 0.2968 | -0.0000002946 | 0.0000003998 | fixed |
| male | 0.001435 | 0.0007497 | 1.914 | -0.00003438 | 0.002904 | fixed |
| sibling_count3 | -0.001804 | 0.001508 | -1.197 | -0.00476 | 0.001151 | fixed |
| sibling_count4 | 0.000616 | 0.001517 | 0.4059 | -0.002358 | 0.00359 | fixed |
| sibling_count5 | -0.0009842 | 0.001574 | -0.6252 | -0.00407 | 0.002101 | fixed |
| sibling_count5+ | -0.0007791 | 0.001338 | -0.5825 | -0.003401 | 0.001843 | fixed |
| sd_(Intercept).mother_pidlink | 0.000000005156 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.03649 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.0006085 | 0.008007 | -0.07599 | -0.0163 | 0.01508 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0002089 | 0.0007162 | 0.2916 | -0.001195 | 0.001613 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.000007051 | 0.00002004 | -0.3519 | -0.00004633 | 0.00003222 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00000006636 | 0.0000001772 | 0.3744 | -0.000000281 | 0.0000004138 | fixed |
| male | 0.00143 | 0.0007498 | 1.907 | -0.00003985 | 0.002899 | fixed |
| sibling_count3 | -0.001577 | 0.001534 | -1.028 | -0.004583 | 0.001429 | fixed |
| sibling_count4 | 0.001223 | 0.001566 | 0.7812 | -0.001846 | 0.004293 | fixed |
| sibling_count5 | -0.0005539 | 0.001638 | -0.3382 | -0.003764 | 0.002656 | fixed |
| sibling_count5+ | -0.00006166 | 0.00141 | -0.04372 | -0.002826 | 0.002702 | fixed |
| birth_order_nonlinear2 | -0.00004771 | 0.001109 | -0.04303 | -0.002221 | 0.002126 | fixed |
| birth_order_nonlinear3 | -0.0008901 | 0.001289 | -0.6904 | -0.003417 | 0.001637 | fixed |
| birth_order_nonlinear4 | -0.002 | 0.001448 | -1.382 | -0.004838 | 0.0008371 | fixed |
| birth_order_nonlinear5 | 0.000813 | 0.001625 | 0.5004 | -0.002372 | 0.003998 | fixed |
| birth_order_nonlinear5+ | -0.0004879 | 0.001322 | -0.369 | -0.003079 | 0.002104 | fixed |
| sd_(Intercept).mother_pidlink | 0.00000001036 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.03649 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.001129 | 0.00804 | -0.1404 | -0.01689 | 0.01463 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0002277 | 0.0007171 | 0.3175 | -0.001178 | 0.001633 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.000007642 | 0.00002005 | -0.3811 | -0.00004695 | 0.00003166 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00000007203 | 0.0000001773 | 0.4062 | -0.0000002756 | 0.0000004196 | fixed |
| male | 0.001399 | 0.0007502 | 1.865 | -0.00007127 | 0.00287 | fixed |
| count_birth_order2/2 | 0.0008908 | 0.002215 | 0.4021 | -0.003451 | 0.005233 | fixed |
| count_birth_order1/3 | -0.001422 | 0.002092 | -0.6798 | -0.005522 | 0.002678 | fixed |
| count_birth_order2/3 | -0.001456 | 0.002328 | -0.6254 | -0.006017 | 0.003106 | fixed |
| count_birth_order3/3 | -0.001499 | 0.002556 | -0.5867 | -0.006508 | 0.003509 | fixed |
| count_birth_order1/4 | 0.003658 | 0.002303 | 1.588 | -0.0008556 | 0.008173 | fixed |
| count_birth_order2/4 | 0.001647 | 0.00247 | 0.6669 | -0.003194 | 0.006489 | fixed |
| count_birth_order3/4 | -0.001469 | 0.002605 | -0.5637 | -0.006575 | 0.003638 | fixed |
| count_birth_order4/4 | -0.001533 | 0.002805 | -0.5465 | -0.00703 | 0.003965 | fixed |
| count_birth_order1/5 | -0.001484 | 0.002599 | -0.5709 | -0.006577 | 0.00361 | fixed |
| count_birth_order2/5 | 0.00277 | 0.002759 | 1.004 | -0.002637 | 0.008178 | fixed |
| count_birth_order3/5 | -0.001468 | 0.002903 | -0.5055 | -0.007158 | 0.004222 | fixed |
| count_birth_order4/5 | -0.001597 | 0.003066 | -0.521 | -0.007606 | 0.004411 | fixed |
| count_birth_order5/5 | -0.001528 | 0.00307 | -0.4976 | -0.007545 | 0.00449 | fixed |
| count_birth_order1/5+ | 0.0001466 | 0.00201 | 0.07294 | -0.003793 | 0.004087 | fixed |
| count_birth_order2/5+ | -0.001418 | 0.00209 | -0.6783 | -0.005515 | 0.002679 | fixed |
| count_birth_order3/5+ | 0.0002647 | 0.002069 | 0.1279 | -0.003791 | 0.00432 | fixed |
| count_birth_order4/5+ | -0.001477 | 0.002027 | -0.729 | -0.00545 | 0.002495 | fixed |
| count_birth_order5/5+ | 0.001744 | 0.002049 | 0.8512 | -0.002272 | 0.00576 | fixed |
| count_birth_order5+/5+ | -0.0001939 | 0.001632 | -0.1188 | -0.003393 | 0.003005 | fixed |
| sd_(Intercept).mother_pidlink | 0.00000001384 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.03649 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -36894 | -36815 | 18458 | -36916 | NA | NA | NA |
| 12 | -36892 | -36806 | 18458 | -36916 | 0.3464 | 1 | 0.5562 |
| 16 | -36887 | -36772 | 18460 | -36919 | 3.056 | 4 | 0.5484 |
| 26 | -36874 | -36687 | 18463 | -36926 | 7.077 | 10 | 0.7181 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01904 | 0.02438 | -0.7808 | -0.06683 | 0.02875 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.00222 | 0.002615 | 0.8488 | -0.002906 | 0.007345 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00006986 | 0.00008957 | -0.7799 | -0.0002454 | 0.0001057 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000006769 | 0.0000009816 | 0.6896 | -0.000001247 | 0.000002601 | fixed |
| male | 0.001275 | 0.001234 | 1.033 | -0.001144 | 0.003695 | fixed |
| sibling_count3 | -0.002135 | 0.001996 | -1.07 | -0.006047 | 0.001777 | fixed |
| sibling_count4 | -0.003247 | 0.002052 | -1.582 | -0.007268 | 0.0007746 | fixed |
| sibling_count5 | -0.001205 | 0.002273 | -0.5304 | -0.00566 | 0.003249 | fixed |
| sibling_count5+ | -0.002255 | 0.00196 | -1.15 | -0.006098 | 0.001587 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.03688 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01893 | 0.02439 | -0.7762 | -0.06673 | 0.02887 | fixed |
| birth_order | 0.0001139 | 0.0003773 | 0.302 | -0.0006255 | 0.0008534 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.002195 | 0.002617 | 0.839 | -0.002933 | 0.007324 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00006929 | 0.0000896 | -0.7733 | -0.0002449 | 0.0001063 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000006754 | 0.0000009817 | 0.688 | -0.000001249 | 0.000002599 | fixed |
| male | 0.001271 | 0.001235 | 1.029 | -0.001149 | 0.00369 | fixed |
| sibling_count3 | -0.002192 | 0.002005 | -1.093 | -0.006121 | 0.001738 | fixed |
| sibling_count4 | -0.00337 | 0.002092 | -1.611 | -0.007472 | 0.0007308 | fixed |
| sibling_count5 | -0.001409 | 0.002371 | -0.5944 | -0.006056 | 0.003238 | fixed |
| sibling_count5+ | -0.00266 | 0.002374 | -1.12 | -0.007313 | 0.001994 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.03689 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01804 | 0.0244 | -0.7394 | -0.06587 | 0.02979 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.002198 | 0.002617 | 0.8399 | -0.002931 | 0.007327 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00006814 | 0.00008961 | -0.7603 | -0.0002438 | 0.0001075 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000006483 | 0.0000009821 | 0.6601 | -0.000001276 | 0.000002573 | fixed |
| male | 0.001222 | 0.001235 | 0.9901 | -0.001198 | 0.003642 | fixed |
| sibling_count3 | -0.001531 | 0.002047 | -0.7481 | -0.005542 | 0.00248 | fixed |
| sibling_count4 | -0.002233 | 0.002175 | -1.027 | -0.006497 | 0.00203 | fixed |
| sibling_count5 | 0.0001622 | 0.002493 | 0.06504 | -0.004725 | 0.005049 | fixed |
| sibling_count5+ | -0.001611 | 0.002443 | -0.6594 | -0.0064 | 0.003178 | fixed |
| birth_order_nonlinear2 | -0.003122 | 0.001656 | -1.886 | -0.006368 | 0.0001233 | fixed |
| birth_order_nonlinear3 | -0.002794 | 0.00194 | -1.44 | -0.006597 | 0.001009 | fixed |
| birth_order_nonlinear4 | -0.003035 | 0.002365 | -1.284 | -0.00767 | 0.0016 | fixed |
| birth_order_nonlinear5 | -0.003377 | 0.002899 | -1.165 | -0.009059 | 0.002304 | fixed |
| birth_order_nonlinear5+ | -0.0000936 | 0.002817 | -0.03323 | -0.005614 | 0.005427 | fixed |
| sd_(Intercept).mother_pidlink | 0.00000001012 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.03688 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01888 | 0.02451 | -0.7703 | -0.06692 | 0.02916 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.002348 | 0.002629 | 0.8932 | -0.002804 | 0.0075 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00007276 | 0.00009004 | -0.8081 | -0.0002492 | 0.0001037 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000006932 | 0.0000009869 | 0.7024 | -0.000001241 | 0.000002627 | fixed |
| male | 0.001217 | 0.001237 | 0.9839 | -0.001208 | 0.003642 | fixed |
| count_birth_order2/2 | -0.005185 | 0.003234 | -1.603 | -0.01152 | 0.001153 | fixed |
| count_birth_order1/3 | -0.002396 | 0.002674 | -0.8963 | -0.007636 | 0.002844 | fixed |
| count_birth_order2/3 | -0.005014 | 0.002973 | -1.687 | -0.01084 | 0.0008128 | fixed |
| count_birth_order3/3 | -0.005052 | 0.00324 | -1.559 | -0.0114 | 0.001299 | fixed |
| count_birth_order1/4 | -0.004789 | 0.003067 | -1.561 | -0.0108 | 0.001222 | fixed |
| count_birth_order2/4 | -0.004976 | 0.003253 | -1.529 | -0.01135 | 0.0014 | fixed |
| count_birth_order3/4 | -0.004932 | 0.003375 | -1.461 | -0.01155 | 0.001683 | fixed |
| count_birth_order4/4 | -0.005233 | 0.003613 | -1.448 | -0.01231 | 0.001848 | fixed |
| count_birth_order1/5 | 0.004607 | 0.004041 | 1.14 | -0.003313 | 0.01253 | fixed |
| count_birth_order2/5 | -0.004763 | 0.004362 | -1.092 | -0.01331 | 0.003786 | fixed |
| count_birth_order3/5 | -0.004893 | 0.004147 | -1.18 | -0.01302 | 0.003235 | fixed |
| count_birth_order4/5 | -0.005202 | 0.004046 | -1.286 | -0.01313 | 0.002729 | fixed |
| count_birth_order5/5 | -0.005179 | 0.004259 | -1.216 | -0.01353 | 0.003169 | fixed |
| count_birth_order1/5+ | -0.004681 | 0.003823 | -1.224 | -0.01217 | 0.002812 | fixed |
| count_birth_order2/5+ | -0.00473 | 0.003857 | -1.226 | -0.01229 | 0.002829 | fixed |
| count_birth_order3/5+ | -0.004821 | 0.003765 | -1.28 | -0.0122 | 0.00256 | fixed |
| count_birth_order4/5+ | -0.004809 | 0.003688 | -1.304 | -0.01204 | 0.002419 | fixed |
| count_birth_order5/5+ | -0.004901 | 0.003524 | -1.391 | -0.01181 | 0.002007 | fixed |
| count_birth_order5+/5+ | -0.002395 | 0.002722 | -0.8798 | -0.007729 | 0.00294 | fixed |
| sd_(Intercept).mother_pidlink | 0.0000000003251 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.03691 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -13809 | -13741 | 6916 | -13831 | NA | NA | NA |
| 12 | -13807 | -13733 | 6916 | -13831 | 0.09146 | 1 | 0.7623 |
| 16 | -13805 | -13705 | 6918 | -13837 | 5.574 | 4 | 0.2333 |
| 26 | -13790 | -13628 | 6921 | -13842 | 4.71 | 10 | 0.9097 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01904 | 0.02419 | -0.7868 | -0.06646 | 0.02838 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.002273 | 0.002597 | 0.875 | -0.002818 | 0.007363 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00007096 | 0.00008898 | -0.7975 | -0.0002454 | 0.0001034 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000006852 | 0.0000009753 | 0.7025 | -0.000001226 | 0.000002597 | fixed |
| male | 0.001309 | 0.001226 | 1.067 | -0.001094 | 0.003712 | fixed |
| sibling_count3 | -0.002695 | 0.002183 | -1.235 | -0.006973 | 0.001583 | fixed |
| sibling_count4 | -0.004092 | 0.002196 | -1.864 | -0.008396 | 0.0002107 | fixed |
| sibling_count5 | -0.002261 | 0.002303 | -0.9815 | -0.006775 | 0.002254 | fixed |
| sibling_count5+ | -0.00326 | 0.00202 | -1.614 | -0.00722 | 0.0006995 | fixed |
| sd_(Intercept).mother_pidlink | 0.00000001331 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.03676 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01896 | 0.0242 | -0.7833 | -0.06639 | 0.02847 | fixed |
| birth_order | 0.0001029 | 0.0003309 | 0.3109 | -0.0005457 | 0.0007515 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.002253 | 0.002598 | 0.8669 | -0.00284 | 0.007346 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00007051 | 0.000089 | -0.7923 | -0.000245 | 0.0001039 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000006846 | 0.0000009754 | 0.7018 | -0.000001227 | 0.000002596 | fixed |
| male | 0.001304 | 0.001226 | 1.064 | -0.001099 | 0.003708 | fixed |
| sibling_count3 | -0.002747 | 0.002189 | -1.255 | -0.007037 | 0.001544 | fixed |
| sibling_count4 | -0.004195 | 0.00222 | -1.889 | -0.008547 | 0.0001569 | fixed |
| sibling_count5 | -0.002432 | 0.002369 | -1.027 | -0.007075 | 0.00221 | fixed |
| sibling_count5+ | -0.003621 | 0.00233 | -1.554 | -0.008187 | 0.0009452 | fixed |
| sd_(Intercept).mother_pidlink | 0.00000003172 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.03676 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01787 | 0.02422 | -0.7379 | -0.06533 | 0.02959 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.002244 | 0.002599 | 0.8634 | -0.00285 | 0.007338 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00006906 | 0.00008903 | -0.7757 | -0.0002435 | 0.0001054 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000006551 | 0.0000009758 | 0.6713 | -0.000001258 | 0.000002568 | fixed |
| male | 0.001255 | 0.001226 | 1.023 | -0.001149 | 0.003658 | fixed |
| sibling_count3 | -0.002103 | 0.002228 | -0.944 | -0.006471 | 0.002264 | fixed |
| sibling_count4 | -0.003207 | 0.00229 | -1.4 | -0.007695 | 0.001281 | fixed |
| sibling_count5 | -0.001055 | 0.002481 | -0.4253 | -0.005918 | 0.003807 | fixed |
| sibling_count5+ | -0.002713 | 0.002404 | -1.129 | -0.007424 | 0.001998 | fixed |
| birth_order_nonlinear2 | -0.003291 | 0.001669 | -1.972 | -0.006562 | -0.00001936 | fixed |
| birth_order_nonlinear3 | -0.002759 | 0.001942 | -1.42 | -0.006566 | 0.001048 | fixed |
| birth_order_nonlinear4 | -0.002861 | 0.002297 | -1.245 | -0.007363 | 0.001641 | fixed |
| birth_order_nonlinear5 | -0.003159 | 0.002798 | -1.129 | -0.008642 | 0.002324 | fixed |
| birth_order_nonlinear5+ | -0.00035 | 0.002537 | -0.1379 | -0.005323 | 0.004623 | fixed |
| sd_(Intercept).mother_pidlink | 0.000000005965 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.03675 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01698 | 0.02429 | -0.6991 | -0.0646 | 0.03063 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.00227 | 0.002608 | 0.8703 | -0.002841 | 0.007381 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0000702 | 0.00008935 | -0.7857 | -0.0002453 | 0.0001049 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000006703 | 0.0000009796 | 0.6843 | -0.00000125 | 0.00000259 | fixed |
| male | 0.001227 | 0.001229 | 0.9981 | -0.001183 | 0.003637 | fixed |
| count_birth_order2/2 | -0.006385 | 0.00353 | -1.809 | -0.0133 | 0.0005343 | fixed |
| count_birth_order1/3 | -0.003068 | 0.002946 | -1.041 | -0.008843 | 0.002707 | fixed |
| count_birth_order2/3 | -0.006267 | 0.00321 | -1.952 | -0.01256 | 0.0000252 | fixed |
| count_birth_order3/3 | -0.006277 | 0.003561 | -1.763 | -0.01326 | 0.0007021 | fixed |
| count_birth_order1/4 | -0.006116 | 0.003198 | -1.913 | -0.01238 | 0.0001512 | fixed |
| count_birth_order2/4 | -0.006265 | 0.003371 | -1.859 | -0.01287 | 0.0003419 | fixed |
| count_birth_order3/4 | -0.006214 | 0.003651 | -1.702 | -0.01337 | 0.0009411 | fixed |
| count_birth_order4/4 | -0.006527 | 0.003966 | -1.646 | -0.0143 | 0.001246 | fixed |
| count_birth_order1/5 | 0.001582 | 0.003866 | 0.4093 | -0.005996 | 0.00916 | fixed |
| count_birth_order2/5 | -0.006089 | 0.003966 | -1.535 | -0.01386 | 0.001684 | fixed |
| count_birth_order3/5 | -0.006068 | 0.004082 | -1.486 | -0.01407 | 0.001933 | fixed |
| count_birth_order4/5 | -0.006315 | 0.004157 | -1.519 | -0.01446 | 0.001832 | fixed |
| count_birth_order5/5 | -0.006395 | 0.004222 | -1.515 | -0.01467 | 0.001879 | fixed |
| count_birth_order1/5+ | -0.00598 | 0.003485 | -1.716 | -0.01281 | 0.0008499 | fixed |
| count_birth_order2/5+ | -0.006117 | 0.003686 | -1.66 | -0.01334 | 0.001106 | fixed |
| count_birth_order3/5+ | -0.006069 | 0.003552 | -1.709 | -0.01303 | 0.0008932 | fixed |
| count_birth_order4/5+ | -0.006211 | 0.003452 | -1.799 | -0.01298 | 0.0005554 | fixed |
| count_birth_order5/5+ | -0.006157 | 0.003658 | -1.683 | -0.01333 | 0.001011 | fixed |
| count_birth_order5+/5+ | -0.004098 | 0.002734 | -1.499 | -0.009457 | 0.00126 | fixed |
| sd_(Intercept).mother_pidlink | 0.00000001386 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.03678 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -13925 | -13856 | 6973 | -13947 | NA | NA | NA |
| 12 | -13923 | -13848 | 6973 | -13947 | 0.09692 | 1 | 0.7556 |
| 16 | -13920 | -13821 | 6976 | -13952 | 5.536 | 4 | 0.2366 |
| 26 | -13904 | -13743 | 6978 | -13956 | 4.304 | 10 | 0.9326 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.02014 | 0.02484 | -0.8108 | -0.06881 | 0.02854 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.002324 | 0.002668 | 0.871 | -0.002905 | 0.007553 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00007334 | 0.00009147 | -0.8018 | -0.0002526 | 0.0001059 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000007122 | 0.000001003 | 0.7098 | -0.000001255 | 0.000002679 | fixed |
| male | 0.001306 | 0.001257 | 1.039 | -0.001157 | 0.003769 | fixed |
| sibling_count3 | -0.002062 | 0.001971 | -1.046 | -0.005924 | 0.0018 | fixed |
| sibling_count4 | -0.003122 | 0.002055 | -1.52 | -0.00715 | 0.000905 | fixed |
| sibling_count5 | -0.0008557 | 0.002335 | -0.3665 | -0.005432 | 0.003721 | fixed |
| sibling_count5+ | -0.002037 | 0.001982 | -1.028 | -0.005921 | 0.001848 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.03721 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01997 | 0.02484 | -0.804 | -0.06867 | 0.02872 | fixed |
| birth_order | 0.0001248 | 0.0003922 | 0.3183 | -0.0006439 | 0.0008935 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.002292 | 0.00267 | 0.8585 | -0.002941 | 0.007526 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00007255 | 0.00009151 | -0.7927 | -0.0002519 | 0.0001068 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000007088 | 0.000001004 | 0.7062 | -0.000001258 | 0.000002676 | fixed |
| male | 0.001304 | 0.001257 | 1.038 | -0.001159 | 0.003767 | fixed |
| sibling_count3 | -0.002125 | 0.001981 | -1.073 | -0.006007 | 0.001757 | fixed |
| sibling_count4 | -0.003256 | 0.002098 | -1.552 | -0.007368 | 0.0008552 | fixed |
| sibling_count5 | -0.001071 | 0.002431 | -0.4406 | -0.005836 | 0.003694 | fixed |
| sibling_count5+ | -0.00248 | 0.002422 | -1.024 | -0.007228 | 0.002268 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.03721 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01926 | 0.02486 | -0.7748 | -0.06798 | 0.02946 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.002317 | 0.00267 | 0.8677 | -0.002916 | 0.007551 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00007222 | 0.00009152 | -0.7891 | -0.0002516 | 0.0001072 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000000692 | 0.000001004 | 0.6892 | -0.000001276 | 0.00000266 | fixed |
| male | 0.001266 | 0.001257 | 1.008 | -0.001197 | 0.00373 | fixed |
| sibling_count3 | -0.00148 | 0.002025 | -0.7309 | -0.005448 | 0.002488 | fixed |
| sibling_count4 | -0.002126 | 0.002182 | -0.9744 | -0.006403 | 0.002151 | fixed |
| sibling_count5 | 0.0004233 | 0.002547 | 0.1662 | -0.004569 | 0.005415 | fixed |
| sibling_count5+ | -0.001472 | 0.002497 | -0.5893 | -0.006366 | 0.003423 | fixed |
| birth_order_nonlinear2 | -0.003103 | 0.001663 | -1.866 | -0.006363 | 0.0001568 | fixed |
| birth_order_nonlinear3 | -0.002762 | 0.00196 | -1.409 | -0.006603 | 0.00108 | fixed |
| birth_order_nonlinear4 | -0.003046 | 0.002457 | -1.239 | -0.007861 | 0.00177 | fixed |
| birth_order_nonlinear5 | -0.003403 | 0.003029 | -1.123 | -0.009339 | 0.002533 | fixed |
| birth_order_nonlinear5+ | 0.00008479 | 0.002932 | 0.02891 | -0.005663 | 0.005832 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.03721 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01999 | 0.02495 | -0.8009 | -0.0689 | 0.02892 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.002455 | 0.002681 | 0.9155 | -0.0028 | 0.00771 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00007656 | 0.00009193 | -0.8328 | -0.0002567 | 0.0001036 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000007349 | 0.000001009 | 0.7286 | -0.000001242 | 0.000002712 | fixed |
| male | 0.00125 | 0.001259 | 0.9929 | -0.001218 | 0.003719 | fixed |
| count_birth_order2/2 | -0.004988 | 0.003173 | -1.572 | -0.01121 | 0.001231 | fixed |
| count_birth_order1/3 | -0.002318 | 0.002649 | -0.8749 | -0.00751 | 0.002875 | fixed |
| count_birth_order2/3 | -0.00488 | 0.002948 | -1.655 | -0.01066 | 0.0008983 | fixed |
| count_birth_order3/3 | -0.004906 | 0.003177 | -1.544 | -0.01113 | 0.001321 | fixed |
| count_birth_order1/4 | -0.004633 | 0.00311 | -1.49 | -0.01073 | 0.001461 | fixed |
| count_birth_order2/4 | -0.004836 | 0.003269 | -1.479 | -0.01124 | 0.001571 | fixed |
| count_birth_order3/4 | -0.004774 | 0.003394 | -1.407 | -0.01142 | 0.001878 | fixed |
| count_birth_order4/4 | -0.005074 | 0.003687 | -1.376 | -0.0123 | 0.002153 | fixed |
| count_birth_order1/5 | 0.00475 | 0.004066 | 1.168 | -0.003218 | 0.01272 | fixed |
| count_birth_order2/5 | -0.004579 | 0.004544 | -1.008 | -0.01349 | 0.004327 | fixed |
| count_birth_order3/5 | -0.004708 | 0.004432 | -1.062 | -0.0134 | 0.003979 | fixed |
| count_birth_order4/5 | -0.005011 | 0.004267 | -1.174 | -0.01337 | 0.003352 | fixed |
| count_birth_order5/5 | -0.005039 | 0.004533 | -1.111 | -0.01392 | 0.003847 | fixed |
| count_birth_order1/5+ | -0.004509 | 0.003959 | -1.139 | -0.01227 | 0.003251 | fixed |
| count_birth_order2/5+ | -0.004502 | 0.004007 | -1.124 | -0.01236 | 0.003352 | fixed |
| count_birth_order3/5+ | -0.00464 | 0.003827 | -1.212 | -0.01214 | 0.002862 | fixed |
| count_birth_order4/5+ | -0.00463 | 0.003846 | -1.204 | -0.01217 | 0.002908 | fixed |
| count_birth_order5/5+ | -0.00472 | 0.003611 | -1.307 | -0.0118 | 0.002357 | fixed |
| count_birth_order5+/5+ | -0.002027 | 0.002777 | -0.7299 | -0.007471 | 0.003416 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.03723 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -13505 | -13437 | 6763 | -13527 | NA | NA | NA |
| 12 | -13503 | -13429 | 6763 | -13527 | 0.1016 | 1 | 0.75 |
| 16 | -13500 | -13401 | 6766 | -13532 | 5.511 | 4 | 0.2388 |
| 26 | -13485 | -13324 | 6768 | -13537 | 4.409 | 10 | 0.927 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = `Sector_Electricity, gas, water`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.01323 | 0.0289 | 0.4577 | -0.04342 | 0.06987 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0002009 | 0.002584 | 0.07776 | -0.004864 | 0.005266 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00001341 | 0.0000723 | 0.1854 | -0.0001283 | 0.0001551 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000002622 | 0.0000006399 | -0.4098 | -0.000001516 | 0.0000009919 | fixed |
| male | 0.00005814 | 0.002704 | 0.02151 | -0.005241 | 0.005357 | fixed |
| sibling_count3 | -0.006514 | 0.005475 | -1.19 | -0.01724 | 0.004217 | fixed |
| sibling_count4 | 0.000643 | 0.005507 | 0.1168 | -0.01015 | 0.01144 | fixed |
| sibling_count5 | -0.01138 | 0.005702 | -1.996 | -0.02256 | -0.000205 | fixed |
| sibling_count5+ | -0.007491 | 0.004458 | -1.68 | -0.01623 | 0.001247 | fixed |
| sd_(Intercept).mother_pidlink | 0.02111 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1299 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.01323 | 0.0289 | 0.4578 | -0.04341 | 0.06988 | fixed |
| birth_order | 0.00004662 | 0.0005342 | 0.08727 | -0.001 | 0.001094 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0001884 | 0.002588 | 0.07277 | -0.004885 | 0.005262 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00001385 | 0.00007248 | 0.191 | -0.0001282 | 0.0001559 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000002661 | 0.0000006415 | -0.4149 | -0.000001523 | 0.0000009911 | fixed |
| male | 0.00005683 | 0.002704 | 0.02102 | -0.005243 | 0.005356 | fixed |
| sibling_count3 | -0.006527 | 0.005477 | -1.192 | -0.01726 | 0.004208 | fixed |
| sibling_count4 | 0.000612 | 0.005519 | 0.1109 | -0.01021 | 0.01143 | fixed |
| sibling_count5 | -0.01143 | 0.005733 | -1.994 | -0.02267 | -0.0001956 | fixed |
| sibling_count5+ | -0.007659 | 0.004856 | -1.577 | -0.01718 | 0.001858 | fixed |
| sd_(Intercept).mother_pidlink | 0.02113 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1299 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.01097 | 0.02895 | 0.3791 | -0.04577 | 0.06772 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0002737 | 0.002591 | 0.1057 | -0.004805 | 0.005352 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.000009057 | 0.00007253 | 0.1249 | -0.0001331 | 0.0001512 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000002072 | 0.0000006418 | -0.3228 | -0.000001465 | 0.000001051 | fixed |
| male | 0.00005964 | 0.002704 | 0.02205 | -0.00524 | 0.00536 | fixed |
| sibling_count3 | -0.006954 | 0.005568 | -1.249 | -0.01787 | 0.003959 | fixed |
| sibling_count4 | 0.0003152 | 0.00569 | 0.0554 | -0.01084 | 0.01147 | fixed |
| sibling_count5 | -0.01083 | 0.005956 | -1.819 | -0.0225 | 0.0008413 | fixed |
| sibling_count5+ | -0.005929 | 0.005111 | -1.16 | -0.01595 | 0.004088 | fixed |
| birth_order_nonlinear2 | 0.006418 | 0.003984 | 1.611 | -0.001391 | 0.01423 | fixed |
| birth_order_nonlinear3 | 0.003461 | 0.004631 | 0.7474 | -0.005616 | 0.01254 | fixed |
| birth_order_nonlinear4 | 0.001524 | 0.005203 | 0.2928 | -0.008674 | 0.01172 | fixed |
| birth_order_nonlinear5 | -0.002664 | 0.005841 | -0.456 | -0.01411 | 0.008785 | fixed |
| birth_order_nonlinear5+ | -0.0001667 | 0.004776 | -0.03491 | -0.009528 | 0.009194 | fixed |
| sd_(Intercept).mother_pidlink | 0.02114 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1299 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.008777 | 0.02906 | 0.302 | -0.04818 | 0.06574 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0003881 | 0.002593 | 0.1496 | -0.004695 | 0.005471 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.000006036 | 0.00007257 | 0.08317 | -0.0001362 | 0.0001483 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000001841 | 0.0000006421 | -0.2867 | -0.000001443 | 0.000001074 | fixed |
| male | -0.0001087 | 0.002705 | -0.04017 | -0.00541 | 0.005193 | fixed |
| count_birth_order2/2 | 0.009253 | 0.00795 | 1.164 | -0.006328 | 0.02483 | fixed |
| count_birth_order1/3 | -0.002485 | 0.007543 | -0.3295 | -0.01727 | 0.0123 | fixed |
| count_birth_order2/3 | -0.003798 | 0.008393 | -0.4525 | -0.02025 | 0.01265 | fixed |
| count_birth_order3/3 | -0.003063 | 0.009215 | -0.3324 | -0.02113 | 0.015 | fixed |
| count_birth_order1/4 | -0.006877 | 0.008305 | -0.8281 | -0.02315 | 0.0094 | fixed |
| count_birth_order2/4 | 0.02091 | 0.008908 | 2.347 | 0.003452 | 0.03837 | fixed |
| count_birth_order3/4 | 0.001834 | 0.009395 | 0.1952 | -0.01658 | 0.02025 | fixed |
| count_birth_order4/4 | 0.002255 | 0.01012 | 0.2229 | -0.01757 | 0.02208 | fixed |
| count_birth_order1/5 | -0.005294 | 0.009369 | -0.5651 | -0.02366 | 0.01307 | fixed |
| count_birth_order2/5 | -0.01186 | 0.009948 | -1.192 | -0.03135 | 0.007642 | fixed |
| count_birth_order3/5 | -0.01047 | 0.01047 | -1 | -0.03098 | 0.01005 | fixed |
| count_birth_order4/5 | 0.008094 | 0.01105 | 0.7322 | -0.01357 | 0.02976 | fixed |
| count_birth_order5/5 | -0.01984 | 0.01107 | -1.793 | -0.04154 | 0.001853 | fixed |
| count_birth_order1/5+ | -0.003349 | 0.007249 | -0.462 | -0.01756 | 0.01086 | fixed |
| count_birth_order2/5+ | -0.0008831 | 0.007537 | -0.1172 | -0.01566 | 0.01389 | fixed |
| count_birth_order3/5+ | 0.001765 | 0.007461 | 0.2366 | -0.01286 | 0.01639 | fixed |
| count_birth_order4/5+ | -0.00785 | 0.007308 | -1.074 | -0.02217 | 0.006472 | fixed |
| count_birth_order5/5+ | -0.005377 | 0.007388 | -0.7278 | -0.01986 | 0.009103 | fixed |
| count_birth_order5+/5+ | -0.005087 | 0.005909 | -0.861 | -0.01667 | 0.006494 | fixed |
| sd_(Intercept).mother_pidlink | 0.02122 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1299 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -11872 | -11793 | 5947 | -11894 | NA | NA | NA |
| 12 | -11870 | -11783 | 5947 | -11894 | 0.007754 | 1 | 0.9298 |
| 16 | -11866 | -11751 | 5949 | -11898 | 4.007 | 4 | 0.405 |
| 26 | -11858 | -11671 | 5955 | -11910 | 12.21 | 10 | 0.271 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.06892 | 0.08321 | -0.8282 | -0.232 | 0.09418 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.009208 | 0.008926 | 1.032 | -0.008286 | 0.0267 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0003094 | 0.0003058 | -1.012 | -0.0009087 | 0.0002899 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000003375 | 0.000003352 | 1.007 | -0.000003194 | 0.000009944 | fixed |
| male | -0.003225 | 0.004207 | -0.7666 | -0.01147 | 0.00502 | fixed |
| sibling_count3 | -0.004733 | 0.006873 | -0.6886 | -0.0182 | 0.008738 | fixed |
| sibling_count4 | 0.0002426 | 0.007083 | 0.03425 | -0.01364 | 0.01413 | fixed |
| sibling_count5 | -0.003574 | 0.007875 | -0.4539 | -0.01901 | 0.01186 | fixed |
| sibling_count5+ | 0.000262 | 0.006798 | 0.03854 | -0.01306 | 0.01359 | fixed |
| sd_(Intercept).mother_pidlink | 0.02884 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1224 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.0693 | 0.08324 | -0.8326 | -0.2324 | 0.09384 | fixed |
| birth_order | -0.0003813 | 0.001296 | -0.2942 | -0.002922 | 0.002159 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.009293 | 0.008932 | 1.04 | -0.008213 | 0.0268 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0003114 | 0.0003059 | -1.018 | -0.000911 | 0.0002881 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000003381 | 0.000003352 | 1.009 | -0.000003189 | 0.000009951 | fixed |
| male | -0.00321 | 0.004208 | -0.7627 | -0.01146 | 0.005038 | fixed |
| sibling_count3 | -0.004544 | 0.006904 | -0.6581 | -0.01808 | 0.008988 | fixed |
| sibling_count4 | 0.0006594 | 0.007225 | 0.09126 | -0.0135 | 0.01482 | fixed |
| sibling_count5 | -0.002889 | 0.008215 | -0.3516 | -0.01899 | 0.01321 | fixed |
| sibling_count5+ | 0.001623 | 0.008225 | 0.1974 | -0.0145 | 0.01774 | fixed |
| sd_(Intercept).mother_pidlink | 0.02889 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1224 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.07098 | 0.08333 | -0.8518 | -0.2343 | 0.09234 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.00929 | 0.008936 | 1.04 | -0.008224 | 0.02681 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0003122 | 0.0003061 | -1.02 | -0.0009121 | 0.0002877 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000003395 | 0.000003355 | 1.012 | -0.00000318 | 0.000009971 | fixed |
| male | -0.003165 | 0.00421 | -0.7517 | -0.01142 | 0.005087 | fixed |
| sibling_count3 | -0.00357 | 0.007046 | -0.5067 | -0.01738 | 0.01024 | fixed |
| sibling_count4 | 0.002033 | 0.007502 | 0.271 | -0.01267 | 0.01674 | fixed |
| sibling_count5 | -0.001211 | 0.00862 | -0.1405 | -0.01811 | 0.01568 | fixed |
| sibling_count5+ | 0.003208 | 0.008457 | 0.3793 | -0.01337 | 0.01978 | fixed |
| birth_order_nonlinear2 | 0.004487 | 0.005605 | 0.8006 | -0.006498 | 0.01547 | fixed |
| birth_order_nonlinear3 | -0.004523 | 0.006574 | -0.688 | -0.01741 | 0.008361 | fixed |
| birth_order_nonlinear4 | -0.001963 | 0.00802 | -0.2447 | -0.01768 | 0.01376 | fixed |
| birth_order_nonlinear5 | -0.001521 | 0.009835 | -0.1547 | -0.0208 | 0.01776 | fixed |
| birth_order_nonlinear5+ | -0.002346 | 0.009645 | -0.2432 | -0.02125 | 0.01656 | fixed |
| sd_(Intercept).mother_pidlink | 0.02914 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1224 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.07149 | 0.08369 | -0.8543 | -0.2355 | 0.09253 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.009321 | 0.008976 | 1.038 | -0.008272 | 0.02691 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.000314 | 0.0003075 | -1.021 | -0.0009167 | 0.0002888 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000003412 | 0.000003372 | 1.012 | -0.000003197 | 0.00001002 | fixed |
| male | -0.002905 | 0.004218 | -0.6887 | -0.01117 | 0.005363 | fixed |
| count_birth_order2/2 | 0.005885 | 0.01094 | 0.5379 | -0.01556 | 0.02733 | fixed |
| count_birth_order1/3 | -0.004307 | 0.009118 | -0.4724 | -0.02218 | 0.01356 | fixed |
| count_birth_order2/3 | 0.001187 | 0.01014 | 0.1171 | -0.01868 | 0.02106 | fixed |
| count_birth_order3/3 | -0.005007 | 0.01105 | -0.4533 | -0.02666 | 0.01664 | fixed |
| count_birth_order1/4 | 0.0067 | 0.01046 | 0.6405 | -0.0138 | 0.0272 | fixed |
| count_birth_order2/4 | 0.005103 | 0.01109 | 0.4601 | -0.01664 | 0.02684 | fixed |
| count_birth_order3/4 | 0.001785 | 0.0115 | 0.1551 | -0.02076 | 0.02433 | fixed |
| count_birth_order4/4 | -0.008181 | 0.01232 | -0.6643 | -0.03232 | 0.01596 | fixed |
| count_birth_order1/5 | -0.005837 | 0.01378 | -0.4236 | -0.03285 | 0.02117 | fixed |
| count_birth_order2/5 | 0.01789 | 0.01487 | 1.203 | -0.01126 | 0.04703 | fixed |
| count_birth_order3/5 | -0.01558 | 0.01414 | -1.102 | -0.04328 | 0.01213 | fixed |
| count_birth_order4/5 | -0.006235 | 0.01379 | -0.4522 | -0.03326 | 0.02079 | fixed |
| count_birth_order5/5 | 0.005751 | 0.01451 | 0.3963 | -0.02269 | 0.0342 | fixed |
| count_birth_order1/5+ | 0.005701 | 0.01305 | 0.4368 | -0.01988 | 0.03128 | fixed |
| count_birth_order2/5+ | 0.0003942 | 0.01316 | 0.02996 | -0.02539 | 0.02618 | fixed |
| count_birth_order3/5+ | -0.001544 | 0.01284 | -0.1203 | -0.02671 | 0.02362 | fixed |
| count_birth_order4/5+ | 0.01352 | 0.01257 | 1.076 | -0.01112 | 0.03816 | fixed |
| count_birth_order5/5+ | -0.002532 | 0.01201 | -0.2108 | -0.02608 | 0.02101 | fixed |
| count_birth_order5+/5+ | 0.001374 | 0.009344 | 0.147 | -0.01694 | 0.01969 | fixed |
| sd_(Intercept).mother_pidlink | 0.02937 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1224 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -4799 | -4731 | 2410 | -4821 | NA | NA | NA |
| 12 | -4797 | -4723 | 2411 | -4821 | 0.08637 | 1 | 0.7688 |
| 16 | -4791 | -4692 | 2411 | -4823 | 1.815 | 4 | 0.7697 |
| 26 | -4777 | -4615 | 2414 | -4829 | 5.762 | 10 | 0.8349 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.07294 | 0.08327 | -0.8759 | -0.2362 | 0.09027 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.009914 | 0.00894 | 1.109 | -0.007609 | 0.02744 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0003348 | 0.0003063 | -1.093 | -0.0009353 | 0.0002656 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000003659 | 0.000003359 | 1.089 | -0.000002924 | 0.00001024 | fixed |
| male | -0.003755 | 0.004214 | -0.8909 | -0.01201 | 0.004505 | fixed |
| sibling_count3 | -0.005675 | 0.007576 | -0.7491 | -0.02052 | 0.009173 | fixed |
| sibling_count4 | -0.005706 | 0.007633 | -0.7476 | -0.02067 | 0.009254 | fixed |
| sibling_count5 | -0.00168 | 0.008027 | -0.2093 | -0.01741 | 0.01405 | fixed |
| sibling_count5+ | -0.00157 | 0.007039 | -0.2231 | -0.01537 | 0.01223 | fixed |
| sd_(Intercept).mother_pidlink | 0.02896 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.123 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.07311 | 0.08329 | -0.8777 | -0.2364 | 0.09014 | fixed |
| birth_order | -0.0002085 | 0.001148 | -0.1815 | -0.002459 | 0.002042 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.009956 | 0.008945 | 1.113 | -0.007576 | 0.02749 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0003358 | 0.0003064 | -1.096 | -0.0009364 | 0.0002648 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00000366 | 0.000003359 | 1.09 | -0.000002924 | 0.00001024 | fixed |
| male | -0.003746 | 0.004215 | -0.8887 | -0.01201 | 0.004516 | fixed |
| sibling_count3 | -0.005571 | 0.007599 | -0.7331 | -0.02046 | 0.009323 | fixed |
| sibling_count4 | -0.005497 | 0.007721 | -0.7119 | -0.02063 | 0.009636 | fixed |
| sibling_count5 | -0.001332 | 0.008257 | -0.1613 | -0.01751 | 0.01485 | fixed |
| sibling_count5+ | -0.0008368 | 0.008118 | -0.1031 | -0.01675 | 0.01507 | fixed |
| sd_(Intercept).mother_pidlink | 0.02901 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1231 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.07406 | 0.08335 | -0.8886 | -0.2374 | 0.0893 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.009711 | 0.008946 | 1.086 | -0.007823 | 0.02725 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0003301 | 0.0003065 | -1.077 | -0.0009309 | 0.0002706 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000003623 | 0.000003361 | 1.078 | -0.000002963 | 0.00001021 | fixed |
| male | -0.003724 | 0.004215 | -0.8835 | -0.01199 | 0.004537 | fixed |
| sibling_count3 | -0.005213 | 0.00773 | -0.6743 | -0.02036 | 0.009938 | fixed |
| sibling_count4 | -0.005691 | 0.007954 | -0.7155 | -0.02128 | 0.009899 | fixed |
| sibling_count5 | -0.0003466 | 0.008631 | -0.04016 | -0.01726 | 0.01657 | fixed |
| sibling_count5+ | 0.0007911 | 0.008365 | 0.09457 | -0.0156 | 0.01719 | fixed |
| birth_order_nonlinear2 | 0.011 | 0.005694 | 1.933 | -0.000156 | 0.02217 | fixed |
| birth_order_nonlinear3 | -0.001224 | 0.006636 | -0.1845 | -0.01423 | 0.01178 | fixed |
| birth_order_nonlinear4 | 0.005638 | 0.007857 | 0.7176 | -0.009762 | 0.02104 | fixed |
| birth_order_nonlinear5 | -0.003972 | 0.009571 | -0.415 | -0.02273 | 0.01479 | fixed |
| birth_order_nonlinear5+ | -0.00001819 | 0.008764 | -0.002076 | -0.0172 | 0.01716 | fixed |
| sd_(Intercept).mother_pidlink | 0.0295 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1229 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.06463 | 0.08354 | -0.7736 | -0.2284 | 0.09911 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.008684 | 0.008969 | 0.9682 | -0.008895 | 0.02626 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002926 | 0.0003074 | -0.9519 | -0.000895 | 0.0003099 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000003186 | 0.000003371 | 0.9452 | -0.000003421 | 0.000009793 | fixed |
| male | -0.003631 | 0.004221 | -0.8603 | -0.0119 | 0.004642 | fixed |
| count_birth_order2/2 | 0.009313 | 0.01203 | 0.7738 | -0.01427 | 0.0329 | fixed |
| count_birth_order1/3 | -0.01236 | 0.01012 | -1.221 | -0.03219 | 0.00748 | fixed |
| count_birth_order2/3 | 0.0116 | 0.01102 | 1.052 | -0.01001 | 0.03321 | fixed |
| count_birth_order3/3 | -0.003213 | 0.01222 | -0.2628 | -0.02717 | 0.02074 | fixed |
| count_birth_order1/4 | -0.01075 | 0.01098 | -0.9789 | -0.03228 | 0.01078 | fixed |
| count_birth_order2/4 | 0.01045 | 0.01158 | 0.9025 | -0.01224 | 0.03314 | fixed |
| count_birth_order3/4 | -0.002847 | 0.01253 | -0.2271 | -0.02741 | 0.02172 | fixed |
| count_birth_order4/4 | -0.007088 | 0.01361 | -0.5207 | -0.03377 | 0.01959 | fixed |
| count_birth_order1/5 | 0.01516 | 0.01328 | 1.141 | -0.01087 | 0.04118 | fixed |
| count_birth_order2/5 | 0.008984 | 0.01362 | 0.6598 | -0.01771 | 0.03567 | fixed |
| count_birth_order3/5 | -0.01683 | 0.01401 | -1.201 | -0.0443 | 0.01063 | fixed |
| count_birth_order4/5 | -0.007029 | 0.01427 | -0.4927 | -0.03499 | 0.02093 | fixed |
| count_birth_order5/5 | 0.003691 | 0.01449 | 0.2548 | -0.0247 | 0.03208 | fixed |
| count_birth_order1/5+ | 0.004812 | 0.01198 | 0.4017 | -0.01866 | 0.02829 | fixed |
| count_birth_order2/5+ | -0.003156 | 0.01266 | -0.2493 | -0.02797 | 0.02166 | fixed |
| count_birth_order3/5+ | 0.0007469 | 0.0122 | 0.06123 | -0.02316 | 0.02465 | fixed |
| count_birth_order4/5+ | 0.01669 | 0.01185 | 1.408 | -0.006541 | 0.03992 | fixed |
| count_birth_order5/5+ | -0.009497 | 0.01255 | -0.7565 | -0.0341 | 0.01511 | fixed |
| count_birth_order5+/5+ | 0.000137 | 0.009443 | 0.01451 | -0.01837 | 0.01865 | fixed |
| sd_(Intercept).mother_pidlink | 0.03021 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1227 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -4793 | -4725 | 2408 | -4815 | NA | NA | NA |
| 12 | -4791 | -4717 | 2408 | -4815 | 0.03277 | 1 | 0.8563 |
| 16 | -4789 | -4689 | 2410 | -4821 | 5.725 | 4 | 0.2207 |
| 26 | -4781 | -4619 | 2416 | -4833 | 11.8 | 10 | 0.2989 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.0498 | 0.0826 | -0.603 | -0.2117 | 0.1121 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.007002 | 0.008874 | 0.789 | -0.01039 | 0.0244 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002367 | 0.0003043 | -0.778 | -0.0008331 | 0.0003596 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000002649 | 0.000003339 | 0.7933 | -0.000003896 | 0.000009194 | fixed |
| male | -0.002382 | 0.004174 | -0.5707 | -0.01056 | 0.005798 | fixed |
| sibling_count3 | -0.00575 | 0.00661 | -0.8699 | -0.01871 | 0.007206 | fixed |
| sibling_count4 | 0.002621 | 0.006909 | 0.3793 | -0.01092 | 0.01616 | fixed |
| sibling_count5 | -0.001736 | 0.007888 | -0.22 | -0.0172 | 0.01373 | fixed |
| sibling_count5+ | -0.001253 | 0.006699 | -0.187 | -0.01438 | 0.01188 | fixed |
| sd_(Intercept).mother_pidlink | 0.02772 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1205 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.04939 | 0.08263 | -0.5978 | -0.2113 | 0.1126 | fixed |
| birth_order | 0.0003003 | 0.001312 | 0.2289 | -0.002272 | 0.002872 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.006922 | 0.008882 | 0.7793 | -0.01049 | 0.02433 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002347 | 0.0003045 | -0.7709 | -0.0008314 | 0.000362 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00000264 | 0.00000334 | 0.7903 | -0.000003907 | 0.000009186 | fixed |
| male | -0.002386 | 0.004174 | -0.5716 | -0.01057 | 0.005795 | fixed |
| sibling_count3 | -0.005903 | 0.006644 | -0.8883 | -0.01893 | 0.00712 | fixed |
| sibling_count4 | 0.002296 | 0.007054 | 0.3255 | -0.01153 | 0.01612 | fixed |
| sibling_count5 | -0.002258 | 0.008213 | -0.2749 | -0.01835 | 0.01384 | fixed |
| sibling_count5+ | -0.002324 | 0.008174 | -0.2844 | -0.01835 | 0.0137 | fixed |
| sd_(Intercept).mother_pidlink | 0.02771 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1205 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.05159 | 0.08271 | -0.6238 | -0.2137 | 0.1105 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.007037 | 0.008885 | 0.792 | -0.01038 | 0.02445 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002395 | 0.0003046 | -0.7862 | -0.0008365 | 0.0003575 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000027 | 0.000003342 | 0.8077 | -0.000003851 | 0.00000925 | fixed |
| male | -0.002368 | 0.004176 | -0.567 | -0.01055 | 0.005817 | fixed |
| sibling_count3 | -0.00439 | 0.006788 | -0.6468 | -0.01769 | 0.008914 | fixed |
| sibling_count4 | 0.00465 | 0.007327 | 0.6346 | -0.009711 | 0.01901 | fixed |
| sibling_count5 | 0.00009162 | 0.008584 | 0.01067 | -0.01673 | 0.01692 | fixed |
| sibling_count5+ | -0.0008097 | 0.008416 | -0.09621 | -0.0173 | 0.01568 | fixed |
| birth_order_nonlinear2 | 0.005265 | 0.005486 | 0.9597 | -0.005488 | 0.01602 | fixed |
| birth_order_nonlinear3 | -0.005105 | 0.006471 | -0.7888 | -0.01779 | 0.007579 | fixed |
| birth_order_nonlinear4 | -0.002657 | 0.008121 | -0.3272 | -0.01857 | 0.01326 | fixed |
| birth_order_nonlinear5 | 0.002499 | 0.01001 | 0.2497 | -0.01712 | 0.02212 | fixed |
| birth_order_nonlinear5+ | 0.003725 | 0.009781 | 0.3809 | -0.01544 | 0.0229 | fixed |
| sd_(Intercept).mother_pidlink | 0.02781 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1205 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.05244 | 0.08302 | -0.6316 | -0.2152 | 0.1103 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.007219 | 0.008922 | 0.8091 | -0.01027 | 0.0247 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0002477 | 0.000306 | -0.8097 | -0.0008474 | 0.0003519 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000002801 | 0.000003358 | 0.8341 | -0.000003781 | 0.000009382 | fixed |
| male | -0.002176 | 0.004184 | -0.5202 | -0.01038 | 0.006024 | fixed |
| count_birth_order2/2 | 0.004609 | 0.01046 | 0.4405 | -0.0159 | 0.02511 | fixed |
| count_birth_order1/3 | -0.004567 | 0.008804 | -0.5187 | -0.02182 | 0.01269 | fixed |
| count_birth_order2/3 | -0.002892 | 0.009793 | -0.2953 | -0.02209 | 0.0163 | fixed |
| count_birth_order3/3 | -0.00515 | 0.01055 | -0.4882 | -0.02583 | 0.01553 | fixed |
| count_birth_order1/4 | 0.007362 | 0.01033 | 0.7125 | -0.01289 | 0.02761 | fixed |
| count_birth_order2/4 | 0.01055 | 0.01086 | 0.972 | -0.01073 | 0.03184 | fixed |
| count_birth_order3/4 | 0.00207 | 0.01127 | 0.1836 | -0.02002 | 0.02416 | fixed |
| count_birth_order4/4 | -0.007332 | 0.01224 | -0.5988 | -0.03133 | 0.01667 | fixed |
| count_birth_order1/5 | -0.006338 | 0.01351 | -0.4691 | -0.03282 | 0.02014 | fixed |
| count_birth_order2/5 | 0.02056 | 0.01509 | 1.362 | -0.009021 | 0.05014 | fixed |
| count_birth_order3/5 | -0.01572 | 0.01472 | -1.068 | -0.04457 | 0.01313 | fixed |
| count_birth_order4/5 | -0.004808 | 0.01417 | -0.3393 | -0.03258 | 0.02296 | fixed |
| count_birth_order5/5 | 0.009342 | 0.01505 | 0.6207 | -0.02016 | 0.03884 | fixed |
| count_birth_order1/5+ | -0.001178 | 0.01317 | -0.0895 | -0.02698 | 0.02463 | fixed |
| count_birth_order2/5+ | 0.001312 | 0.01332 | 0.0985 | -0.02479 | 0.02741 | fixed |
| count_birth_order3/5+ | -0.009649 | 0.01272 | -0.7588 | -0.03457 | 0.01527 | fixed |
| count_birth_order4/5+ | 0.007954 | 0.01277 | 0.6227 | -0.01708 | 0.03299 | fixed |
| count_birth_order5/5+ | -0.002177 | 0.01199 | -0.1815 | -0.02568 | 0.02133 | fixed |
| count_birth_order5+/5+ | 0.002798 | 0.009292 | 0.3011 | -0.01541 | 0.02101 | fixed |
| sd_(Intercept).mother_pidlink | 0.02796 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1206 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -4839 | -4771 | 2430 | -4861 | NA | NA | NA |
| 12 | -4837 | -4762 | 2430 | -4861 | 0.05301 | 1 | 0.8179 |
| 16 | -4832 | -4732 | 2432 | -4864 | 2.872 | 4 | 0.5795 |
| 26 | -4817 | -4656 | 2434 | -4869 | 5.404 | 10 | 0.8626 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = `Sector_Finance, insurance, real estate and business services`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.07441 | 0.09233 | -0.8059 | -0.2554 | 0.1066 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02539 | 0.008265 | 3.072 | 0.009189 | 0.04159 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0006471 | 0.0002316 | -2.795 | -0.001101 | -0.0001933 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000005081 | 0.000002052 | 2.476 | 0.000001059 | 0.000009104 | fixed |
| male | 0.0594 | 0.008556 | 6.943 | 0.04264 | 0.07617 | fixed |
| sibling_count3 | -0.007552 | 0.01779 | -0.4245 | -0.04241 | 0.02731 | fixed |
| sibling_count4 | -0.02384 | 0.01795 | -1.328 | -0.05903 | 0.01135 | fixed |
| sibling_count5 | -0.02626 | 0.01865 | -1.407 | -0.06282 | 0.01031 | fixed |
| sibling_count5+ | -0.05315 | 0.0145 | -3.664 | -0.08158 | -0.02472 | fixed |
| sd_(Intercept).mother_pidlink | 0.1381 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3954 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.07441 | 0.09233 | -0.8059 | -0.2554 | 0.1066 | fixed |
| birth_order | 0.0000267 | 0.001729 | 0.01544 | -0.003363 | 0.003416 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02538 | 0.008279 | 3.066 | 0.009153 | 0.04161 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0006469 | 0.0002322 | -2.785 | -0.001102 | -0.0001917 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000005079 | 0.000002058 | 2.467 | 0.000001045 | 0.000009114 | fixed |
| male | 0.0594 | 0.008556 | 6.943 | 0.04263 | 0.07617 | fixed |
| sibling_count3 | -0.007559 | 0.01779 | -0.4248 | -0.04243 | 0.02732 | fixed |
| sibling_count4 | -0.02386 | 0.01799 | -1.327 | -0.05911 | 0.01139 | fixed |
| sibling_count5 | -0.02628 | 0.01875 | -1.402 | -0.06303 | 0.01046 | fixed |
| sibling_count5+ | -0.05324 | 0.01573 | -3.386 | -0.08406 | -0.02242 | fixed |
| sd_(Intercept).mother_pidlink | 0.1381 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3954 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.07779 | 0.09248 | -0.8411 | -0.2591 | 0.1035 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02597 | 0.008287 | 3.134 | 0.00973 | 0.04221 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0006675 | 0.0002324 | -2.872 | -0.001123 | -0.000212 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000005269 | 0.000002059 | 2.558 | 0.000001233 | 0.000009306 | fixed |
| male | 0.05941 | 0.008557 | 6.943 | 0.04264 | 0.07618 | fixed |
| sibling_count3 | -0.01047 | 0.01806 | -0.58 | -0.04586 | 0.02492 | fixed |
| sibling_count4 | -0.02378 | 0.01848 | -1.287 | -0.06 | 0.01243 | fixed |
| sibling_count5 | -0.02538 | 0.01939 | -1.309 | -0.06338 | 0.01262 | fixed |
| sibling_count5+ | -0.0482 | 0.01647 | -2.927 | -0.08049 | -0.01592 | fixed |
| birth_order_nonlinear2 | -0.0008122 | 0.01249 | -0.06505 | -0.02528 | 0.02366 | fixed |
| birth_order_nonlinear3 | 0.01115 | 0.0145 | 0.7694 | -0.01726 | 0.03957 | fixed |
| birth_order_nonlinear4 | -0.01657 | 0.0163 | -1.016 | -0.04852 | 0.01538 | fixed |
| birth_order_nonlinear5 | -0.005199 | 0.01831 | -0.2839 | -0.04109 | 0.03069 | fixed |
| birth_order_nonlinear5+ | -0.01029 | 0.01518 | -0.6782 | -0.04004 | 0.01945 | fixed |
| sd_(Intercept).mother_pidlink | 0.1378 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3955 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.06935 | 0.09283 | -0.7471 | -0.2513 | 0.1126 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02651 | 0.008296 | 3.195 | 0.01025 | 0.04277 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0006742 | 0.0002325 | -2.899 | -0.00113 | -0.0002185 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000005249 | 0.00000206 | 2.548 | 0.000001211 | 0.000009288 | fixed |
| male | 0.05988 | 0.008562 | 6.994 | 0.0431 | 0.07666 | fixed |
| count_birth_order2/2 | -0.04629 | 0.02487 | -1.861 | -0.09504 | 0.002463 | fixed |
| count_birth_order1/3 | -0.01612 | 0.02398 | -0.6721 | -0.06313 | 0.03089 | fixed |
| count_birth_order2/3 | -0.02574 | 0.02667 | -0.9651 | -0.07801 | 0.02653 | fixed |
| count_birth_order3/3 | -0.04184 | 0.02927 | -1.429 | -0.09922 | 0.01553 | fixed |
| count_birth_order1/4 | -0.05395 | 0.02639 | -2.044 | -0.1057 | -0.00223 | fixed |
| count_birth_order2/4 | -0.02768 | 0.0283 | -0.978 | -0.08314 | 0.02779 | fixed |
| count_birth_order3/4 | -0.02782 | 0.02984 | -0.9325 | -0.0863 | 0.03066 | fixed |
| count_birth_order4/4 | -0.05826 | 0.03211 | -1.814 | -0.1212 | 0.004687 | fixed |
| count_birth_order1/5 | -0.05281 | 0.02975 | -1.775 | -0.1111 | 0.00549 | fixed |
| count_birth_order2/5 | -0.02327 | 0.03158 | -0.7369 | -0.08516 | 0.03862 | fixed |
| count_birth_order3/5 | -0.02847 | 0.03321 | -0.8573 | -0.09357 | 0.03662 | fixed |
| count_birth_order4/5 | -0.09112 | 0.03505 | -2.6 | -0.1598 | -0.02242 | fixed |
| count_birth_order5/5 | -0.03226 | 0.03512 | -0.9184 | -0.1011 | 0.03658 | fixed |
| count_birth_order1/5+ | -0.08272 | 0.023 | -3.596 | -0.1278 | -0.03763 | fixed |
| count_birth_order2/5+ | -0.06344 | 0.02391 | -2.654 | -0.1103 | -0.01658 | fixed |
| count_birth_order3/5+ | -0.04458 | 0.02366 | -1.884 | -0.09096 | 0.001796 | fixed |
| count_birth_order4/5+ | -0.07335 | 0.02319 | -3.163 | -0.1188 | -0.0279 | fixed |
| count_birth_order5/5+ | -0.0759 | 0.02343 | -3.239 | -0.1218 | -0.02997 | fixed |
| count_birth_order5+/5+ | -0.07606 | 0.01898 | -4.007 | -0.1133 | -0.03886 | fixed |
| sd_(Intercept).mother_pidlink | 0.1378 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3956 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 10644 | 10723 | -5311 | 10622 | NA | NA | NA |
| 12 | 10646 | 10732 | -5311 | 10622 | 0.0002311 | 1 | 0.9879 |
| 16 | 10651 | 10766 | -5309 | 10619 | 3.022 | 4 | 0.5542 |
| 26 | 10661 | 10848 | -5305 | 10609 | 9.616 | 10 | 0.4748 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5687 | 0.2886 | -1.971 | -1.134 | -0.003089 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0821 | 0.03095 | 2.653 | 0.02144 | 0.1428 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002522 | 0.00106 | -2.378 | -0.0046 | -0.0004438 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002507 | 0.00001162 | 2.157 | 0.000002289 | 0.00004785 | fixed |
| male | 0.05418 | 0.01459 | 3.715 | 0.0256 | 0.08277 | fixed |
| sibling_count3 | -0.03401 | 0.02387 | -1.424 | -0.0808 | 0.01278 | fixed |
| sibling_count4 | -0.04521 | 0.02461 | -1.837 | -0.09345 | 0.00303 | fixed |
| sibling_count5 | -0.09774 | 0.02738 | -3.57 | -0.1514 | -0.04408 | fixed |
| sibling_count5+ | -0.08594 | 0.02364 | -3.636 | -0.1323 | -0.03961 | fixed |
| sd_(Intercept).mother_pidlink | 0.1082 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4226 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5687 | 0.2886 | -1.97 | -1.134 | -0.002995 | fixed |
| birth_order | -0.00005679 | 0.004499 | -0.01262 | -0.008875 | 0.008761 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08212 | 0.03097 | 2.651 | 0.02141 | 0.1428 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002522 | 0.001061 | -2.378 | -0.004602 | -0.0004432 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002507 | 0.00001163 | 2.157 | 0.000002286 | 0.00004786 | fixed |
| male | 0.05418 | 0.01459 | 3.714 | 0.02559 | 0.08278 | fixed |
| sibling_count3 | -0.03398 | 0.02398 | -1.417 | -0.08098 | 0.01303 | fixed |
| sibling_count4 | -0.04515 | 0.02511 | -1.798 | -0.09435 | 0.00406 | fixed |
| sibling_count5 | -0.09764 | 0.02856 | -3.419 | -0.1536 | -0.04166 | fixed |
| sibling_count5+ | -0.08574 | 0.02859 | -2.999 | -0.1418 | -0.0297 | fixed |
| sd_(Intercept).mother_pidlink | 0.1083 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4226 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5737 | 0.2889 | -1.986 | -1.14 | -0.007463 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08249 | 0.03098 | 2.662 | 0.02176 | 0.1432 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002533 | 0.001061 | -2.387 | -0.004613 | -0.0004533 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002515 | 0.00001163 | 2.162 | 0.000002352 | 0.00004795 | fixed |
| male | 0.05423 | 0.01459 | 3.715 | 0.02562 | 0.08283 | fixed |
| sibling_count3 | -0.02672 | 0.02446 | -1.092 | -0.07466 | 0.02122 | fixed |
| sibling_count4 | -0.03303 | 0.02605 | -1.268 | -0.08408 | 0.01803 | fixed |
| sibling_count5 | -0.08304 | 0.02994 | -2.773 | -0.1417 | -0.02435 | fixed |
| sibling_count5+ | -0.07479 | 0.02938 | -2.546 | -0.1324 | -0.01721 | fixed |
| birth_order_nonlinear2 | 0.004422 | 0.01941 | 0.2278 | -0.03362 | 0.04246 | fixed |
| birth_order_nonlinear3 | -0.03044 | 0.02277 | -1.337 | -0.07506 | 0.01418 | fixed |
| birth_order_nonlinear4 | -0.02453 | 0.02778 | -0.8831 | -0.07898 | 0.02992 | fixed |
| birth_order_nonlinear5 | -0.01353 | 0.03407 | -0.3972 | -0.0803 | 0.05324 | fixed |
| birth_order_nonlinear5+ | -0.002097 | 0.03345 | -0.06269 | -0.06766 | 0.06347 | fixed |
| sd_(Intercept).mother_pidlink | 0.1081 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4227 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5355 | 0.2901 | -1.846 | -1.104 | 0.03302 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.07959 | 0.03111 | 2.558 | 0.01861 | 0.1406 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002426 | 0.001066 | -2.276 | -0.004515 | -0.0003364 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002391 | 0.00001169 | 2.046 | 0.000001001 | 0.00004681 | fixed |
| male | 0.05452 | 0.01462 | 3.73 | 0.02587 | 0.08318 | fixed |
| count_birth_order2/2 | -0.03903 | 0.03789 | -1.03 | -0.1133 | 0.03524 | fixed |
| count_birth_order1/3 | -0.04971 | 0.03161 | -1.573 | -0.1117 | 0.01223 | fixed |
| count_birth_order2/3 | -0.01491 | 0.03514 | -0.4244 | -0.08378 | 0.05396 | fixed |
| count_birth_order3/3 | -0.08276 | 0.03828 | -2.162 | -0.1578 | -0.007725 | fixed |
| count_birth_order1/4 | -0.05126 | 0.03626 | -1.414 | -0.1223 | 0.01981 | fixed |
| count_birth_order2/4 | -0.05105 | 0.03844 | -1.328 | -0.1264 | 0.0243 | fixed |
| count_birth_order3/4 | -0.09079 | 0.03987 | -2.277 | -0.1689 | -0.01265 | fixed |
| count_birth_order4/4 | -0.03882 | 0.04268 | -0.9094 | -0.1225 | 0.04484 | fixed |
| count_birth_order1/5 | -0.1067 | 0.04777 | -2.234 | -0.2003 | -0.0131 | fixed |
| count_birth_order2/5 | -0.08707 | 0.05153 | -1.69 | -0.1881 | 0.01394 | fixed |
| count_birth_order3/5 | -0.1337 | 0.04899 | -2.728 | -0.2297 | -0.03764 | fixed |
| count_birth_order4/5 | -0.1599 | 0.04779 | -3.345 | -0.2535 | -0.06621 | fixed |
| count_birth_order5/5 | -0.05661 | 0.0503 | -1.126 | -0.1552 | 0.04196 | fixed |
| count_birth_order1/5+ | -0.09304 | 0.04523 | -2.057 | -0.1817 | -0.004385 | fixed |
| count_birth_order2/5+ | -0.07479 | 0.0456 | -1.64 | -0.1642 | 0.01458 | fixed |
| count_birth_order3/5+ | -0.08138 | 0.0445 | -1.829 | -0.1686 | 0.005839 | fixed |
| count_birth_order4/5+ | -0.1182 | 0.04357 | -2.712 | -0.2035 | -0.03277 | fixed |
| count_birth_order5/5+ | -0.1354 | 0.04163 | -3.253 | -0.217 | -0.05382 | fixed |
| count_birth_order5+/5+ | -0.0913 | 0.03241 | -2.817 | -0.1548 | -0.02779 | fixed |
| sd_(Intercept).mother_pidlink | 0.1074 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.423 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 4337 | 4406 | -2158 | 4315 | NA | NA | NA |
| 12 | 4339 | 4414 | -2158 | 4315 | 0.00009047 | 1 | 0.9924 |
| 16 | 4344 | 4444 | -2156 | 4312 | 2.997 | 4 | 0.5583 |
| 26 | 4357 | 4518 | -2152 | 4305 | 7.716 | 10 | 0.6566 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5662 | 0.2875 | -1.97 | -1.13 | -0.002767 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08105 | 0.03086 | 2.626 | 0.02057 | 0.1415 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002488 | 0.001058 | -2.353 | -0.004561 | -0.0004157 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002469 | 0.0000116 | 2.129 | 0.000001961 | 0.00004741 | fixed |
| male | 0.05379 | 0.01454 | 3.699 | 0.02529 | 0.0823 | fixed |
| sibling_count3 | -0.01975 | 0.0262 | -0.7539 | -0.0711 | 0.0316 | fixed |
| sibling_count4 | -0.03216 | 0.0264 | -1.218 | -0.08391 | 0.01959 | fixed |
| sibling_count5 | -0.07215 | 0.02778 | -2.597 | -0.1266 | -0.0177 | fixed |
| sibling_count5+ | -0.07094 | 0.02436 | -2.912 | -0.1187 | -0.0232 | fixed |
| sd_(Intercept).mother_pidlink | 0.1094 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4225 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5664 | 0.2875 | -1.97 | -1.13 | -0.002844 | fixed |
| birth_order | -0.0002095 | 0.00397 | -0.05278 | -0.007991 | 0.007572 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0811 | 0.03088 | 2.626 | 0.02058 | 0.1416 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002489 | 0.001058 | -2.353 | -0.004563 | -0.0004162 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002469 | 0.0000116 | 2.129 | 0.00000196 | 0.00004742 | fixed |
| male | 0.0538 | 0.01455 | 3.699 | 0.02529 | 0.08231 | fixed |
| sibling_count3 | -0.01965 | 0.02628 | -0.7476 | -0.07115 | 0.03186 | fixed |
| sibling_count4 | -0.03195 | 0.02671 | -1.196 | -0.08429 | 0.0204 | fixed |
| sibling_count5 | -0.0718 | 0.02857 | -2.513 | -0.1278 | -0.01579 | fixed |
| sibling_count5+ | -0.0702 | 0.02809 | -2.499 | -0.1253 | -0.01515 | fixed |
| sd_(Intercept).mother_pidlink | 0.1096 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4225 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.578 | 0.2878 | -2.008 | -1.142 | -0.01393 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08201 | 0.03089 | 2.655 | 0.02147 | 0.1426 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002519 | 0.001058 | -2.38 | -0.004593 | -0.0004445 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002491 | 0.0000116 | 2.147 | 0.00000217 | 0.00004766 | fixed |
| male | 0.05398 | 0.01455 | 3.71 | 0.02546 | 0.08249 | fixed |
| sibling_count3 | -0.01423 | 0.02673 | -0.5325 | -0.06663 | 0.03816 | fixed |
| sibling_count4 | -0.01948 | 0.02751 | -0.7081 | -0.07341 | 0.03444 | fixed |
| sibling_count5 | -0.05724 | 0.02986 | -1.917 | -0.1158 | 0.00128 | fixed |
| sibling_count5+ | -0.05202 | 0.02894 | -1.798 | -0.1087 | 0.004701 | fixed |
| birth_order_nonlinear2 | 0.01072 | 0.01963 | 0.5459 | -0.02776 | 0.04919 | fixed |
| birth_order_nonlinear3 | -0.02222 | 0.02288 | -0.9713 | -0.06707 | 0.02262 | fixed |
| birth_order_nonlinear4 | -0.03943 | 0.0271 | -1.455 | -0.09254 | 0.01368 | fixed |
| birth_order_nonlinear5 | -0.007367 | 0.03301 | -0.2232 | -0.07206 | 0.05733 | fixed |
| birth_order_nonlinear5+ | -0.01766 | 0.03028 | -0.5834 | -0.077 | 0.04168 | fixed |
| sd_(Intercept).mother_pidlink | 0.1108 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4222 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.512 | 0.2882 | -1.776 | -1.077 | 0.05292 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.07721 | 0.03094 | 2.495 | 0.01656 | 0.1379 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002343 | 0.001061 | -2.209 | -0.004421 | -0.0002639 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002292 | 0.00001163 | 1.97 | 0.0000001211 | 0.00004571 | fixed |
| male | 0.05323 | 0.01456 | 3.656 | 0.02469 | 0.08177 | fixed |
| count_birth_order2/2 | -0.06461 | 0.04148 | -1.558 | -0.1459 | 0.01669 | fixed |
| count_birth_order1/3 | -0.0366 | 0.03492 | -1.048 | -0.105 | 0.03184 | fixed |
| count_birth_order2/3 | -0.01324 | 0.03804 | -0.348 | -0.08779 | 0.06131 | fixed |
| count_birth_order3/3 | -0.08953 | 0.04217 | -2.123 | -0.1722 | -0.006883 | fixed |
| count_birth_order1/4 | -0.08289 | 0.0379 | -2.187 | -0.1572 | -0.008614 | fixed |
| count_birth_order2/4 | 0.00127 | 0.03994 | 0.03181 | -0.077 | 0.07955 | fixed |
| count_birth_order3/4 | -0.08315 | 0.04323 | -1.923 | -0.1679 | 0.001588 | fixed |
| count_birth_order4/4 | -0.04866 | 0.04696 | -1.036 | -0.1407 | 0.04338 | fixed |
| count_birth_order1/5 | -0.06946 | 0.04581 | -1.516 | -0.1592 | 0.02033 | fixed |
| count_birth_order2/5 | -0.1132 | 0.04698 | -2.409 | -0.2052 | -0.0211 | fixed |
| count_birth_order3/5 | -0.1311 | 0.04834 | -2.712 | -0.2258 | -0.03636 | fixed |
| count_birth_order4/5 | -0.1211 | 0.04921 | -2.46 | -0.2175 | -0.02459 | fixed |
| count_birth_order5/5 | -0.03203 | 0.04997 | -0.641 | -0.13 | 0.06591 | fixed |
| count_birth_order1/5+ | -0.08991 | 0.04133 | -2.176 | -0.1709 | -0.008917 | fixed |
| count_birth_order2/5+ | -0.04979 | 0.04368 | -1.14 | -0.1354 | 0.03581 | fixed |
| count_birth_order3/5+ | -0.04301 | 0.04208 | -1.022 | -0.1255 | 0.03947 | fixed |
| count_birth_order4/5+ | -0.1407 | 0.04088 | -3.442 | -0.2208 | -0.06057 | fixed |
| count_birth_order5/5+ | -0.1239 | 0.0433 | -2.86 | -0.2087 | -0.03899 | fixed |
| count_birth_order5+/5+ | -0.09545 | 0.0326 | -2.928 | -0.1593 | -0.03156 | fixed |
| sd_(Intercept).mother_pidlink | 0.1099 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.422 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 4369 | 4437 | -2173 | 4347 | NA | NA | NA |
| 12 | 4371 | 4445 | -2173 | 4347 | 0.00247 | 1 | 0.9604 |
| 16 | 4375 | 4474 | -2171 | 4343 | 4.144 | 4 | 0.3868 |
| 26 | 4378 | 4539 | -2163 | 4326 | 16.88 | 10 | 0.07713 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5595 | 0.2914 | -1.92 | -1.131 | 0.01169 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0817 | 0.03131 | 2.609 | 0.02033 | 0.1431 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0025 | 0.001074 | -2.329 | -0.004605 | -0.0003961 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002474 | 0.00001178 | 2.1 | 0.000001645 | 0.00004783 | fixed |
| male | 0.05654 | 0.01472 | 3.841 | 0.02769 | 0.08539 | fixed |
| sibling_count3 | -0.05676 | 0.02338 | -2.427 | -0.1026 | -0.01093 | fixed |
| sibling_count4 | -0.04937 | 0.02446 | -2.019 | -0.0973 | -0.001435 | fixed |
| sibling_count5 | -0.1102 | 0.02796 | -3.94 | -0.1649 | -0.05536 | fixed |
| sibling_count5+ | -0.09375 | 0.02374 | -3.949 | -0.1403 | -0.04722 | fixed |
| sd_(Intercept).mother_pidlink | 0.1108 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.422 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5626 | 0.2915 | -1.93 | -1.134 | 0.008759 | fixed |
| birth_order | -0.002165 | 0.004637 | -0.467 | -0.01125 | 0.006922 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08229 | 0.03134 | 2.626 | 0.02087 | 0.1437 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002516 | 0.001074 | -2.342 | -0.004621 | -0.0004102 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002481 | 0.00001178 | 2.105 | 0.000001714 | 0.00004791 | fixed |
| male | 0.05657 | 0.01472 | 3.843 | 0.02772 | 0.08543 | fixed |
| sibling_count3 | -0.05566 | 0.02351 | -2.368 | -0.1017 | -0.009586 | fixed |
| sibling_count4 | -0.04701 | 0.02497 | -1.882 | -0.09596 | 0.001936 | fixed |
| sibling_count5 | -0.1064 | 0.02911 | -3.654 | -0.1634 | -0.04932 | fixed |
| sibling_count5+ | -0.08602 | 0.02896 | -2.97 | -0.1428 | -0.02925 | fixed |
| sd_(Intercept).mother_pidlink | 0.1114 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4219 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5677 | 0.2918 | -1.946 | -1.14 | 0.004187 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08282 | 0.03135 | 2.642 | 0.02137 | 0.1443 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002528 | 0.001075 | -2.352 | -0.004634 | -0.0004216 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002487 | 0.00001179 | 2.108 | 0.000001751 | 0.00004798 | fixed |
| male | 0.05634 | 0.01473 | 3.826 | 0.02748 | 0.08521 | fixed |
| sibling_count3 | -0.04861 | 0.024 | -2.025 | -0.09565 | -0.001557 | fixed |
| sibling_count4 | -0.03533 | 0.02592 | -1.363 | -0.08613 | 0.01548 | fixed |
| sibling_count5 | -0.09458 | 0.0304 | -3.111 | -0.1542 | -0.035 | fixed |
| sibling_count5+ | -0.07499 | 0.0298 | -2.517 | -0.1334 | -0.01659 | fixed |
| birth_order_nonlinear2 | -0.01061 | 0.01931 | -0.5491 | -0.04846 | 0.02725 | fixed |
| birth_order_nonlinear3 | -0.03414 | 0.02279 | -1.499 | -0.0788 | 0.01051 | fixed |
| birth_order_nonlinear4 | -0.03378 | 0.0286 | -1.181 | -0.08984 | 0.02228 | fixed |
| birth_order_nonlinear5 | -0.01735 | 0.03526 | -0.4922 | -0.08645 | 0.05175 | fixed |
| birth_order_nonlinear5+ | -0.0251 | 0.03452 | -0.727 | -0.09277 | 0.04257 | fixed |
| sd_(Intercept).mother_pidlink | 0.111 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4221 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.5353 | 0.2929 | -1.827 | -1.109 | 0.03882 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08019 | 0.03148 | 2.547 | 0.01849 | 0.1419 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002433 | 0.00108 | -2.254 | -0.004549 | -0.0003172 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002378 | 0.00001185 | 2.007 | 0.0000005629 | 0.00004701 | fixed |
| male | 0.0564 | 0.01476 | 3.822 | 0.02748 | 0.08533 | fixed |
| count_birth_order2/2 | -0.04001 | 0.03684 | -1.086 | -0.1122 | 0.03219 | fixed |
| count_birth_order1/3 | -0.06363 | 0.03106 | -2.049 | -0.1245 | -0.002752 | fixed |
| count_birth_order2/3 | -0.05555 | 0.03455 | -1.608 | -0.1233 | 0.01216 | fixed |
| count_birth_order3/3 | -0.09984 | 0.03721 | -2.683 | -0.1728 | -0.0269 | fixed |
| count_birth_order1/4 | -0.04157 | 0.03645 | -1.141 | -0.113 | 0.02987 | fixed |
| count_birth_order2/4 | -0.06433 | 0.0383 | -1.68 | -0.1394 | 0.01074 | fixed |
| count_birth_order3/4 | -0.09248 | 0.03975 | -2.326 | -0.1704 | -0.01457 | fixed |
| count_birth_order4/4 | -0.05644 | 0.04319 | -1.307 | -0.1411 | 0.02821 | fixed |
| count_birth_order1/5 | -0.127 | 0.04766 | -2.664 | -0.2204 | -0.03354 | fixed |
| count_birth_order2/5 | -0.1031 | 0.05323 | -1.937 | -0.2074 | 0.00122 | fixed |
| count_birth_order3/5 | -0.1444 | 0.05191 | -2.782 | -0.2462 | -0.04268 | fixed |
| count_birth_order4/5 | -0.1675 | 0.04997 | -3.352 | -0.2654 | -0.06954 | fixed |
| count_birth_order5/5 | -0.06378 | 0.05308 | -1.202 | -0.1678 | 0.04025 | fixed |
| count_birth_order1/5+ | -0.08858 | 0.04645 | -1.907 | -0.1796 | 0.002461 | fixed |
| count_birth_order2/5+ | -0.08499 | 0.04697 | -1.809 | -0.1771 | 0.007076 | fixed |
| count_birth_order3/5+ | -0.08575 | 0.04485 | -1.912 | -0.1737 | 0.002157 | fixed |
| count_birth_order4/5+ | -0.1208 | 0.04505 | -2.683 | -0.2091 | -0.03255 | fixed |
| count_birth_order5/5+ | -0.1342 | 0.04229 | -3.172 | -0.217 | -0.05126 | fixed |
| count_birth_order5+/5+ | -0.11 | 0.03283 | -3.35 | -0.1743 | -0.04564 | fixed |
| sd_(Intercept).mother_pidlink | 0.1107 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4224 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 4263 | 4331 | -2120 | 4241 | NA | NA | NA |
| 12 | 4264 | 4339 | -2120 | 4240 | 0.2157 | 1 | 0.6424 |
| 16 | 4270 | 4369 | -2119 | 4238 | 2.603 | 4 | 0.6264 |
| 26 | 4284 | 4445 | -2116 | 4232 | 5.553 | 10 | 0.8513 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = Sector_Manufacturing)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5117 | 0.09457 | 5.41 | 0.3263 | 0.6971 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01479 | 0.008466 | -1.747 | -0.03138 | 0.001801 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0002146 | 0.0002372 | 0.9045 | -0.0002504 | 0.0006795 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000006725 | 0.000002103 | -0.3198 | -0.000004794 | 0.000003449 | fixed |
| male | -0.02311 | 0.008759 | -2.639 | -0.04028 | -0.005944 | fixed |
| sibling_count3 | -0.006571 | 0.01824 | -0.3603 | -0.04232 | 0.02917 | fixed |
| sibling_count4 | -0.00687 | 0.01841 | -0.3732 | -0.04295 | 0.02921 | fixed |
| sibling_count5 | 0.01292 | 0.01913 | 0.6752 | -0.02458 | 0.05042 | fixed |
| sibling_count5+ | 0.01186 | 0.01487 | 0.7972 | -0.01729 | 0.04101 | fixed |
| sd_(Intercept).mother_pidlink | 0.1442 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4041 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5117 | 0.09458 | 5.41 | 0.3263 | 0.6971 | fixed |
| birth_order | -0.0001019 | 0.001772 | -0.05749 | -0.003576 | 0.003372 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01476 | 0.008481 | -1.741 | -0.03139 | 0.001859 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0002136 | 0.0002379 | 0.8976 | -0.0002528 | 0.0006799 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000006633 | 0.000002109 | -0.3145 | -0.000004797 | 0.00000347 | fixed |
| male | -0.02311 | 0.00876 | -2.638 | -0.04028 | -0.005941 | fixed |
| sibling_count3 | -0.006544 | 0.01824 | -0.3587 | -0.0423 | 0.02921 | fixed |
| sibling_count4 | -0.006808 | 0.01844 | -0.3691 | -0.04296 | 0.02934 | fixed |
| sibling_count5 | 0.01303 | 0.01923 | 0.6776 | -0.02465 | 0.05071 | fixed |
| sibling_count5+ | 0.01221 | 0.01612 | 0.7577 | -0.01938 | 0.04381 | fixed |
| sd_(Intercept).mother_pidlink | 0.1442 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4041 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.5096 | 0.09474 | 5.379 | 0.3239 | 0.6953 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01469 | 0.008489 | -1.731 | -0.03133 | 0.001947 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0002074 | 0.0002381 | 0.8713 | -0.0002592 | 0.000674 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000005849 | 0.00000211 | -0.2772 | -0.000004721 | 0.000003551 | fixed |
| male | -0.02303 | 0.008761 | -2.629 | -0.04021 | -0.005862 | fixed |
| sibling_count3 | -0.005231 | 0.01851 | -0.2826 | -0.04152 | 0.03105 | fixed |
| sibling_count4 | -0.007222 | 0.01895 | -0.3811 | -0.04436 | 0.02992 | fixed |
| sibling_count5 | 0.01484 | 0.01988 | 0.7462 | -0.02413 | 0.0538 | fixed |
| sibling_count5+ | 0.01629 | 0.01688 | 0.965 | -0.0168 | 0.04938 | fixed |
| birth_order_nonlinear2 | 0.008384 | 0.01278 | 0.6562 | -0.01666 | 0.03343 | fixed |
| birth_order_nonlinear3 | -0.003908 | 0.01484 | -0.2634 | -0.03299 | 0.02517 | fixed |
| birth_order_nonlinear4 | 0.01104 | 0.01668 | 0.6616 | -0.02166 | 0.04373 | fixed |
| birth_order_nonlinear5 | -0.01119 | 0.01874 | -0.5973 | -0.04792 | 0.02554 | fixed |
| birth_order_nonlinear5+ | -0.004781 | 0.01554 | -0.3076 | -0.03525 | 0.02568 | fixed |
| sd_(Intercept).mother_pidlink | 0.1441 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4042 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.4939 | 0.09509 | 5.194 | 0.3075 | 0.6803 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01421 | 0.008498 | -1.673 | -0.03087 | 0.002443 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0001951 | 0.0002382 | 0.8191 | -0.0002718 | 0.0006621 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000000494 | 0.000002111 | -0.234 | -0.000004632 | 0.000003644 | fixed |
| male | -0.02312 | 0.008766 | -2.638 | -0.0403 | -0.005942 | fixed |
| count_birth_order2/2 | 0.03648 | 0.02545 | 1.433 | -0.01341 | 0.08636 | fixed |
| count_birth_order1/3 | 0.01974 | 0.02457 | 0.8034 | -0.02841 | 0.06788 | fixed |
| count_birth_order2/3 | 0.009603 | 0.02731 | 0.3516 | -0.04393 | 0.06314 | fixed |
| count_birth_order3/3 | -0.02071 | 0.02998 | -0.6908 | -0.07947 | 0.03805 | fixed |
| count_birth_order1/4 | 0.008555 | 0.02702 | 0.3166 | -0.04441 | 0.06152 | fixed |
| count_birth_order2/4 | 0.0266 | 0.02898 | 0.9179 | -0.0302 | 0.08341 | fixed |
| count_birth_order3/4 | -0.03689 | 0.03056 | -1.207 | -0.09678 | 0.02299 | fixed |
| count_birth_order4/4 | 0.02723 | 0.03289 | 0.8279 | -0.03723 | 0.09169 | fixed |
| count_birth_order1/5 | 0.04031 | 0.03046 | 1.323 | -0.01939 | 0.1 | fixed |
| count_birth_order2/5 | 0.02362 | 0.03234 | 0.7304 | -0.03976 | 0.087 | fixed |
| count_birth_order3/5 | 0.03578 | 0.03401 | 1.052 | -0.03088 | 0.1024 | fixed |
| count_birth_order4/5 | 0.008249 | 0.03589 | 0.2298 | -0.0621 | 0.0786 | fixed |
| count_birth_order5/5 | 0.01433 | 0.03597 | 0.3985 | -0.05616 | 0.08483 | fixed |
| count_birth_order1/5+ | 0.01689 | 0.02356 | 0.717 | -0.02928 | 0.06306 | fixed |
| count_birth_order2/5+ | 0.01899 | 0.02448 | 0.7757 | -0.02899 | 0.06698 | fixed |
| count_birth_order3/5+ | 0.04577 | 0.02423 | 1.889 | -0.001725 | 0.09326 | fixed |
| count_birth_order4/5+ | 0.04063 | 0.02374 | 1.711 | -0.005906 | 0.08717 | fixed |
| count_birth_order5/5+ | 0.01524 | 0.024 | 0.6352 | -0.03179 | 0.06228 | fixed |
| count_birth_order5+/5+ | 0.02177 | 0.01945 | 1.119 | -0.01635 | 0.05989 | fixed |
| sd_(Intercept).mother_pidlink | 0.1442 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4041 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 11106 | 11186 | -5542 | 11084 | NA | NA | NA |
| 12 | 11108 | 11195 | -5542 | 11084 | 0.003397 | 1 | 0.9535 |
| 16 | 11114 | 11229 | -5541 | 11082 | 2.159 | 4 | 0.7066 |
| 26 | 11124 | 11311 | -5536 | 11072 | 9.91 | 10 | 0.4484 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.6945 | 0.2861 | 2.428 | 0.1338 | 1.255 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.03818 | 0.03069 | -1.244 | -0.09833 | 0.02196 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001072 | 0.001051 | 1.02 | -0.000988 | 0.003133 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001043 | 0.00001152 | -0.9051 | -0.00003302 | 0.00001216 | fixed |
| male | -0.01913 | 0.01445 | -1.324 | -0.04746 | 0.00919 | fixed |
| sibling_count3 | 0.001268 | 0.02378 | 0.05334 | -0.04534 | 0.04787 | fixed |
| sibling_count4 | 0.02087 | 0.02454 | 0.8503 | -0.02723 | 0.06896 | fixed |
| sibling_count5 | 0.02786 | 0.02734 | 1.019 | -0.02573 | 0.08144 | fixed |
| sibling_count5+ | 0.01755 | 0.02361 | 0.7432 | -0.02873 | 0.06382 | fixed |
| sd_(Intercept).mother_pidlink | 0.1269 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4136 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.6924 | 0.2862 | 2.42 | 0.1316 | 1.253 | fixed |
| birth_order | -0.001776 | 0.004471 | -0.3974 | -0.01054 | 0.006986 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.03775 | 0.03071 | -1.229 | -0.09793 | 0.02244 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001062 | 0.001052 | 1.009 | -0.0009998 | 0.003123 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001039 | 0.00001153 | -0.9014 | -0.00003298 | 0.0000122 | fixed |
| male | -0.01907 | 0.01445 | -1.32 | -0.0474 | 0.009257 | fixed |
| sibling_count3 | 0.002154 | 0.02388 | 0.09018 | -0.04466 | 0.04896 | fixed |
| sibling_count4 | 0.02283 | 0.02503 | 0.9121 | -0.02623 | 0.07188 | fixed |
| sibling_count5 | 0.03107 | 0.02851 | 1.09 | -0.02481 | 0.08695 | fixed |
| sibling_count5+ | 0.02391 | 0.02854 | 0.838 | -0.03202 | 0.07985 | fixed |
| sd_(Intercept).mother_pidlink | 0.1266 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4138 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.7097 | 0.2864 | 2.478 | 0.1484 | 1.271 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04004 | 0.03071 | -1.304 | -0.1002 | 0.02015 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001135 | 0.001052 | 1.079 | -0.0009269 | 0.003197 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001111 | 0.00001153 | -0.9635 | -0.00003371 | 0.00001149 | fixed |
| male | -0.01949 | 0.01446 | -1.348 | -0.04783 | 0.00884 | fixed |
| sibling_count3 | 0.002157 | 0.02435 | 0.08859 | -0.04557 | 0.04989 | fixed |
| sibling_count4 | 0.01402 | 0.02595 | 0.5401 | -0.03685 | 0.06489 | fixed |
| sibling_count5 | 0.02613 | 0.02986 | 0.875 | -0.0324 | 0.08466 | fixed |
| sibling_count5+ | 0.02047 | 0.02931 | 0.6984 | -0.03697 | 0.07791 | fixed |
| birth_order_nonlinear2 | 0.008278 | 0.01916 | 0.4321 | -0.02927 | 0.04583 | fixed |
| birth_order_nonlinear3 | -0.003105 | 0.02248 | -0.1381 | -0.04717 | 0.04096 | fixed |
| birth_order_nonlinear4 | 0.0427 | 0.02744 | 1.556 | -0.01109 | 0.09649 | fixed |
| birth_order_nonlinear5 | -0.029 | 0.03366 | -0.8614 | -0.09497 | 0.03698 | fixed |
| birth_order_nonlinear5+ | -0.005666 | 0.03318 | -0.1707 | -0.07071 | 0.05938 | fixed |
| sd_(Intercept).mother_pidlink | 0.128 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4133 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.7378 | 0.2875 | 2.566 | 0.1742 | 1.301 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04289 | 0.03084 | -1.391 | -0.1033 | 0.01755 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001232 | 0.001057 | 1.166 | -0.0008394 | 0.003303 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001216 | 0.00001159 | -1.05 | -0.00003487 | 0.00001055 | fixed |
| male | -0.01952 | 0.01448 | -1.348 | -0.0479 | 0.008861 | fixed |
| count_birth_order2/2 | 0.004085 | 0.0374 | 0.1092 | -0.06922 | 0.07739 | fixed |
| count_birth_order1/3 | 0.01393 | 0.03133 | 0.4445 | -0.04748 | 0.07534 | fixed |
| count_birth_order2/3 | 0.007459 | 0.03483 | 0.2142 | -0.0608 | 0.07572 | fixed |
| count_birth_order3/3 | -0.02574 | 0.03793 | -0.6785 | -0.1001 | 0.04861 | fixed |
| count_birth_order1/4 | -0.01898 | 0.03594 | -0.528 | -0.08942 | 0.05146 | fixed |
| count_birth_order2/4 | 0.0258 | 0.0381 | 0.6772 | -0.04887 | 0.1005 | fixed |
| count_birth_order3/4 | 0.04904 | 0.0395 | 1.241 | -0.02838 | 0.1265 | fixed |
| count_birth_order4/4 | 0.05322 | 0.04228 | 1.259 | -0.02965 | 0.1361 | fixed |
| count_birth_order1/5 | 0.01815 | 0.04733 | 0.3835 | -0.07462 | 0.1109 | fixed |
| count_birth_order2/5 | 0.08403 | 0.05105 | 1.646 | -0.01603 | 0.1841 | fixed |
| count_birth_order3/5 | -0.02305 | 0.04853 | -0.4749 | -0.1182 | 0.07206 | fixed |
| count_birth_order4/5 | 0.07164 | 0.04733 | 1.513 | -0.02114 | 0.1644 | fixed |
| count_birth_order5/5 | -0.001846 | 0.04981 | -0.03705 | -0.09947 | 0.09578 | fixed |
| count_birth_order1/5+ | 0.03997 | 0.04483 | 0.8917 | -0.04789 | 0.1278 | fixed |
| count_birth_order2/5+ | -0.008876 | 0.04517 | -0.1965 | -0.09742 | 0.07966 | fixed |
| count_birth_order3/5+ | 0.03244 | 0.04408 | 0.7359 | -0.05396 | 0.1188 | fixed |
| count_birth_order4/5+ | 0.06151 | 0.04315 | 1.426 | -0.02305 | 0.1461 | fixed |
| count_birth_order5/5+ | -0.01123 | 0.04124 | -0.2723 | -0.09205 | 0.06959 | fixed |
| count_birth_order5+/5+ | 0.01346 | 0.0322 | 0.4178 | -0.04966 | 0.07658 | fixed |
| sd_(Intercept).mother_pidlink | 0.1285 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4133 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 4272 | 4341 | -2125 | 4250 | NA | NA | NA |
| 12 | 4274 | 4349 | -2125 | 4250 | 0.16 | 1 | 0.6892 |
| 16 | 4277 | 4377 | -2123 | 4245 | 4.804 | 4 | 0.3081 |
| 26 | 4290 | 4451 | -2119 | 4238 | 7.584 | 10 | 0.6694 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.6938 | 0.2847 | 2.437 | 0.1359 | 1.252 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.03908 | 0.03056 | -1.279 | -0.09899 | 0.02082 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001103 | 0.001047 | 1.053 | -0.00095 | 0.003155 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001075 | 0.00001148 | -0.936 | -0.00003326 | 0.00001176 | fixed |
| male | -0.01987 | 0.01439 | -1.381 | -0.04808 | 0.008339 | fixed |
| sibling_count3 | 0.02057 | 0.02606 | 0.7896 | -0.0305 | 0.07164 | fixed |
| sibling_count4 | 0.01883 | 0.02628 | 0.7167 | -0.03267 | 0.07034 | fixed |
| sibling_count5 | 0.02997 | 0.02767 | 1.083 | -0.02427 | 0.08421 | fixed |
| sibling_count5+ | 0.02952 | 0.02426 | 1.217 | -0.01803 | 0.07707 | fixed |
| sd_(Intercept).mother_pidlink | 0.1274 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4132 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.6907 | 0.2847 | 2.426 | 0.1327 | 1.249 | fixed |
| birth_order | -0.003004 | 0.003942 | -0.7619 | -0.01073 | 0.004723 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.0384 | 0.03058 | -1.256 | -0.09833 | 0.02153 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001086 | 0.001048 | 1.037 | -0.0009671 | 0.003139 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000107 | 0.00001148 | -0.9316 | -0.00003321 | 0.00001181 | fixed |
| male | -0.01978 | 0.0144 | -1.374 | -0.04799 | 0.00844 | fixed |
| sibling_count3 | 0.02208 | 0.02613 | 0.8452 | -0.02913 | 0.07329 | fixed |
| sibling_count4 | 0.02188 | 0.02657 | 0.8235 | -0.0302 | 0.07397 | fixed |
| sibling_count5 | 0.03503 | 0.02845 | 1.231 | -0.02074 | 0.0908 | fixed |
| sibling_count5+ | 0.04012 | 0.02797 | 1.435 | -0.01469 | 0.09494 | fixed |
| sd_(Intercept).mother_pidlink | 0.1267 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4134 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.7126 | 0.2849 | 2.501 | 0.1543 | 1.271 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04117 | 0.03058 | -1.347 | -0.1011 | 0.01876 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001175 | 0.001048 | 1.122 | -0.000878 | 0.003229 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001154 | 0.00001149 | -1.005 | -0.00003406 | 0.00001097 | fixed |
| male | -0.02032 | 0.01439 | -1.412 | -0.04853 | 0.007889 | fixed |
| sibling_count3 | 0.02206 | 0.02657 | 0.83 | -0.03003 | 0.07414 | fixed |
| sibling_count4 | 0.0125 | 0.02736 | 0.4569 | -0.04113 | 0.06613 | fixed |
| sibling_count5 | 0.03038 | 0.02971 | 1.023 | -0.02785 | 0.08862 | fixed |
| sibling_count5+ | 0.03026 | 0.0288 | 1.051 | -0.02619 | 0.0867 | fixed |
| birth_order_nonlinear2 | 0.000648 | 0.01936 | 0.03347 | -0.0373 | 0.03859 | fixed |
| birth_order_nonlinear3 | -0.006387 | 0.02258 | -0.2829 | -0.05064 | 0.03786 | fixed |
| birth_order_nonlinear4 | 0.04502 | 0.02675 | 1.683 | -0.007412 | 0.09744 | fixed |
| birth_order_nonlinear5 | -0.04231 | 0.03258 | -1.299 | -0.1062 | 0.02155 | fixed |
| birth_order_nonlinear5+ | -0.003707 | 0.03001 | -0.1235 | -0.06252 | 0.05511 | fixed |
| sd_(Intercept).mother_pidlink | 0.1294 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4125 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.715 | 0.2859 | 2.501 | 0.1548 | 1.275 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04177 | 0.03069 | -1.361 | -0.1019 | 0.01837 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001195 | 0.001052 | 1.137 | -0.0008661 | 0.003257 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001175 | 0.00001154 | -1.019 | -0.00003436 | 0.00001086 | fixed |
| male | -0.02002 | 0.01443 | -1.387 | -0.0483 | 0.008265 | fixed |
| count_birth_order2/2 | 0.0098 | 0.041 | 0.239 | -0.07055 | 0.09015 | fixed |
| count_birth_order1/3 | 0.03993 | 0.03463 | 1.153 | -0.02795 | 0.1078 | fixed |
| count_birth_order2/3 | 0.02923 | 0.03772 | 0.7751 | -0.04469 | 0.1032 | fixed |
| count_birth_order3/3 | -0.01499 | 0.0418 | -0.3586 | -0.09692 | 0.06694 | fixed |
| count_birth_order1/4 | 0.008483 | 0.03758 | 0.2257 | -0.06518 | 0.08214 | fixed |
| count_birth_order2/4 | 0.00627 | 0.0396 | 0.1583 | -0.07134 | 0.08388 | fixed |
| count_birth_order3/4 | 0.02997 | 0.04285 | 0.6994 | -0.05402 | 0.114 | fixed |
| count_birth_order4/4 | 0.06428 | 0.04654 | 1.381 | -0.02694 | 0.1555 | fixed |
| count_birth_order1/5 | 0.008951 | 0.04542 | 0.1971 | -0.08008 | 0.09798 | fixed |
| count_birth_order2/5 | 0.06832 | 0.04657 | 1.467 | -0.02296 | 0.1596 | fixed |
| count_birth_order3/5 | 0.02295 | 0.04791 | 0.4791 | -0.07095 | 0.1169 | fixed |
| count_birth_order4/5 | 0.07555 | 0.04877 | 1.549 | -0.02005 | 0.1711 | fixed |
| count_birth_order5/5 | -0.01083 | 0.04952 | -0.2187 | -0.1079 | 0.08622 | fixed |
| count_birth_order1/5+ | 0.03972 | 0.04098 | 0.9691 | -0.04061 | 0.12 | fixed |
| count_birth_order2/5+ | 0.00776 | 0.04329 | 0.1793 | -0.07709 | 0.09261 | fixed |
| count_birth_order3/5+ | 0.04269 | 0.04171 | 1.024 | -0.03905 | 0.1244 | fixed |
| count_birth_order4/5+ | 0.07782 | 0.04052 | 1.921 | -0.001596 | 0.1572 | fixed |
| count_birth_order5/5+ | -0.007665 | 0.04291 | -0.1786 | -0.09176 | 0.07643 | fixed |
| count_birth_order5+/5+ | 0.02949 | 0.03239 | 0.9104 | -0.034 | 0.09298 | fixed |
| sd_(Intercept).mother_pidlink | 0.1294 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4129 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 4295 | 4364 | -2137 | 4273 | NA | NA | NA |
| 12 | 4297 | 4371 | -2136 | 4273 | 0.585 | 1 | 0.4444 |
| 16 | 4298 | 4398 | -2133 | 4266 | 6.406 | 4 | 0.1708 |
| 26 | 4314 | 4476 | -2131 | 4262 | 4.039 | 10 | 0.9455 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.6847 | 0.2888 | 2.371 | 0.1186 | 1.251 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.03708 | 0.03103 | -1.195 | -0.0979 | 0.02374 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001033 | 0.001064 | 0.9707 | -0.001053 | 0.003118 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000009884 | 0.00001168 | -0.8464 | -0.00003277 | 0.000013 | fixed |
| male | -0.02402 | 0.01458 | -1.648 | -0.0526 | 0.004552 | fixed |
| sibling_count3 | 0.006789 | 0.02327 | 0.2917 | -0.03882 | 0.0524 | fixed |
| sibling_count4 | 0.01743 | 0.02436 | 0.7156 | -0.03032 | 0.06518 | fixed |
| sibling_count5 | 0.03358 | 0.0279 | 1.204 | -0.0211 | 0.08826 | fixed |
| sibling_count5+ | 0.0147 | 0.02369 | 0.6205 | -0.03174 | 0.06114 | fixed |
| sd_(Intercept).mother_pidlink | 0.1271 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4135 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.6811 | 0.2889 | 2.357 | 0.1148 | 1.247 | fixed |
| birth_order | -0.002423 | 0.004604 | -0.5263 | -0.01145 | 0.0066 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.03639 | 0.03106 | -1.172 | -0.09727 | 0.02448 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001015 | 0.001065 | 0.9533 | -0.001072 | 0.003102 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000009793 | 0.00001168 | -0.8384 | -0.00003269 | 0.0000131 | fixed |
| male | -0.024 | 0.01458 | -1.646 | -0.05258 | 0.004575 | fixed |
| sibling_count3 | 0.008022 | 0.02339 | 0.343 | -0.03782 | 0.05386 | fixed |
| sibling_count4 | 0.02008 | 0.02487 | 0.8073 | -0.02867 | 0.06882 | fixed |
| sibling_count5 | 0.03781 | 0.02903 | 1.302 | -0.0191 | 0.09471 | fixed |
| sibling_count5+ | 0.02339 | 0.02887 | 0.81 | -0.0332 | 0.07997 | fixed |
| sd_(Intercept).mother_pidlink | 0.1268 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4136 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.6914 | 0.2892 | 2.391 | 0.1246 | 1.258 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.03822 | 0.03107 | -1.23 | -0.09911 | 0.02267 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001074 | 0.001065 | 1.008 | -0.001014 | 0.003161 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001037 | 0.00001169 | -0.8876 | -0.00003328 | 0.00001253 | fixed |
| male | -0.02434 | 0.01459 | -1.669 | -0.05293 | 0.004249 | fixed |
| sibling_count3 | 0.009206 | 0.02388 | 0.3855 | -0.03759 | 0.056 | fixed |
| sibling_count4 | 0.01429 | 0.0258 | 0.5538 | -0.03628 | 0.06485 | fixed |
| sibling_count5 | 0.03383 | 0.03029 | 1.117 | -0.02555 | 0.0932 | fixed |
| sibling_count5+ | 0.02141 | 0.02969 | 0.7211 | -0.03678 | 0.0796 | fixed |
| birth_order_nonlinear2 | 0.01259 | 0.01907 | 0.6599 | -0.0248 | 0.04997 | fixed |
| birth_order_nonlinear3 | -0.008404 | 0.02251 | -0.3733 | -0.05252 | 0.03572 | fixed |
| birth_order_nonlinear4 | 0.03288 | 0.02827 | 1.163 | -0.02252 | 0.08828 | fixed |
| birth_order_nonlinear5 | -0.01862 | 0.03484 | -0.5346 | -0.08691 | 0.04966 | fixed |
| birth_order_nonlinear5+ | -0.01146 | 0.03423 | -0.3349 | -0.07856 | 0.05563 | fixed |
| sd_(Intercept).mother_pidlink | 0.127 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4136 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.7099 | 0.2904 | 2.445 | 0.1407 | 1.279 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.04044 | 0.03121 | -1.296 | -0.1016 | 0.02073 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.001151 | 0.00107 | 1.076 | -0.0009463 | 0.003249 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00001124 | 0.00001175 | -0.9567 | -0.00003426 | 0.00001178 | fixed |
| male | -0.02448 | 0.01462 | -1.675 | -0.05314 | 0.00417 | fixed |
| count_birth_order2/2 | 0.01734 | 0.03639 | 0.4765 | -0.05399 | 0.08867 | fixed |
| count_birth_order1/3 | 0.01849 | 0.03079 | 0.6004 | -0.04186 | 0.07884 | fixed |
| count_birth_order2/3 | 0.02155 | 0.03424 | 0.6293 | -0.04556 | 0.08866 | fixed |
| count_birth_order3/3 | -0.009869 | 0.03687 | -0.2676 | -0.08214 | 0.0624 | fixed |
| count_birth_order1/4 | -0.01049 | 0.03613 | -0.2903 | -0.08131 | 0.06033 | fixed |
| count_birth_order2/4 | 0.027 | 0.03796 | 0.7113 | -0.0474 | 0.1014 | fixed |
| count_birth_order3/4 | 0.03907 | 0.03939 | 0.992 | -0.03813 | 0.1163 | fixed |
| count_birth_order4/4 | 0.05482 | 0.04279 | 1.281 | -0.02905 | 0.1387 | fixed |
| count_birth_order1/5 | 0.03448 | 0.04724 | 0.73 | -0.0581 | 0.1271 | fixed |
| count_birth_order2/5 | 0.06907 | 0.05274 | 1.31 | -0.03429 | 0.1724 | fixed |
| count_birth_order3/5 | 0.004936 | 0.05143 | 0.09599 | -0.09586 | 0.1057 | fixed |
| count_birth_order4/5 | 0.06178 | 0.0495 | 1.248 | -0.03524 | 0.1588 | fixed |
| count_birth_order5/5 | 0.02736 | 0.05258 | 0.5203 | -0.0757 | 0.1304 | fixed |
| count_birth_order1/5+ | 0.05413 | 0.04604 | 1.176 | -0.03611 | 0.1444 | fixed |
| count_birth_order2/5+ | 0.02108 | 0.04654 | 0.4529 | -0.07015 | 0.1123 | fixed |
| count_birth_order3/5+ | 0.006787 | 0.04444 | 0.1527 | -0.08031 | 0.09388 | fixed |
| count_birth_order4/5+ | 0.05472 | 0.04463 | 1.226 | -0.03274 | 0.1422 | fixed |
| count_birth_order5/5+ | -0.00152 | 0.0419 | -0.03627 | -0.08363 | 0.08059 | fixed |
| count_birth_order5+/5+ | 0.01146 | 0.03262 | 0.3515 | -0.05247 | 0.0754 | fixed |
| sd_(Intercept).mother_pidlink | 0.1273 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.4139 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 4196 | 4264 | -2087 | 4174 | NA | NA | NA |
| 12 | 4198 | 4272 | -2087 | 4174 | 0.2797 | 1 | 0.5969 |
| 16 | 4203 | 4302 | -2085 | 4171 | 3.113 | 4 | 0.5391 |
| 26 | 4219 | 4380 | -2084 | 4167 | 3.496 | 10 | 0.9672 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = `Sector_Mining and quarrying`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.03035 | 0.03991 | -0.7605 | -0.1086 | 0.04787 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.002784 | 0.003572 | 0.7794 | -0.004217 | 0.009786 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00004645 | 0.0001001 | -0.4641 | -0.0002426 | 0.0001497 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000002049 | 0.000000887 | 0.231 | -0.000001534 | 0.000001943 | fixed |
| male | 0.02971 | 0.0037 | 8.03 | 0.02246 | 0.03696 | fixed |
| sibling_count3 | -0.0008367 | 0.007684 | -0.1089 | -0.0159 | 0.01422 | fixed |
| sibling_count4 | 0.004985 | 0.007755 | 0.6429 | -0.01021 | 0.02018 | fixed |
| sibling_count5 | 0.006666 | 0.008057 | 0.8274 | -0.009125 | 0.02246 | fixed |
| sibling_count5+ | 0.001122 | 0.006266 | 0.179 | -0.01116 | 0.0134 | fixed |
| sd_(Intercept).mother_pidlink | 0.05891 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1712 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.03038 | 0.03991 | -0.7613 | -0.1086 | 0.04784 | fixed |
| birth_order | 0.0005056 | 0.0007473 | 0.6765 | -0.0009592 | 0.00197 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.002644 | 0.003579 | 0.7388 | -0.00437 | 0.009658 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00004135 | 0.0001004 | -0.412 | -0.0002381 | 0.0001554 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000001591 | 0.0000008896 | 0.1788 | -0.000001585 | 0.000001903 | fixed |
| male | 0.0297 | 0.0037 | 8.027 | 0.02245 | 0.03695 | fixed |
| sibling_count3 | -0.0009676 | 0.007687 | -0.1259 | -0.01603 | 0.0141 | fixed |
| sibling_count4 | 0.004674 | 0.007769 | 0.6016 | -0.01055 | 0.0199 | fixed |
| sibling_count5 | 0.006127 | 0.008097 | 0.7568 | -0.009742 | 0.022 | fixed |
| sibling_count5+ | -0.000655 | 0.006794 | -0.09641 | -0.01397 | 0.01266 | fixed |
| sd_(Intercept).mother_pidlink | 0.05893 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1712 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.02744 | 0.03998 | -0.6864 | -0.1058 | 0.05091 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.002552 | 0.003582 | 0.7125 | -0.004468 | 0.009573 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00003768 | 0.0001004 | -0.3752 | -0.0002345 | 0.0001592 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000001159 | 0.0000008902 | 0.1301 | -0.000001629 | 0.000001861 | fixed |
| male | 0.02973 | 0.0037 | 8.035 | 0.02248 | 0.03698 | fixed |
| sibling_count3 | 0.0002275 | 0.007802 | 0.02916 | -0.01506 | 0.01552 | fixed |
| sibling_count4 | 0.004558 | 0.007985 | 0.5709 | -0.01109 | 0.02021 | fixed |
| sibling_count5 | 0.00631 | 0.008377 | 0.7532 | -0.01011 | 0.02273 | fixed |
| sibling_count5+ | -0.0008504 | 0.007119 | -0.1195 | -0.0148 | 0.0131 | fixed |
| birth_order_nonlinear2 | -0.004173 | 0.0054 | -0.7729 | -0.01476 | 0.00641 | fixed |
| birth_order_nonlinear3 | -0.005299 | 0.00627 | -0.8451 | -0.01759 | 0.006991 | fixed |
| birth_order_nonlinear4 | 0.006777 | 0.00705 | 0.9613 | -0.007041 | 0.02059 | fixed |
| birth_order_nonlinear5 | -0.00166 | 0.00792 | -0.2096 | -0.01718 | 0.01386 | fixed |
| birth_order_nonlinear5+ | 0.002234 | 0.006562 | 0.3404 | -0.01063 | 0.0151 | fixed |
| sd_(Intercept).mother_pidlink | 0.05905 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1712 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.0343 | 0.04011 | -0.8551 | -0.1129 | 0.04432 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.002683 | 0.003585 | 0.7484 | -0.004343 | 0.009709 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00004222 | 0.0001005 | -0.4202 | -0.0002392 | 0.0001547 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000001617 | 0.0000008903 | 0.1816 | -0.000001583 | 0.000001907 | fixed |
| male | 0.0297 | 0.003701 | 8.025 | 0.02245 | 0.03695 | fixed |
| count_birth_order2/2 | 0.01138 | 0.01075 | 1.058 | -0.009698 | 0.03246 | fixed |
| count_birth_order1/3 | 0.005769 | 0.01037 | 0.5566 | -0.01455 | 0.02608 | fixed |
| count_birth_order2/3 | 0.01716 | 0.01153 | 1.489 | -0.005428 | 0.03975 | fixed |
| count_birth_order3/3 | -0.01888 | 0.01265 | -1.492 | -0.04367 | 0.005919 | fixed |
| count_birth_order1/4 | 0.01393 | 0.0114 | 1.222 | -0.008416 | 0.03628 | fixed |
| count_birth_order2/4 | -0.005393 | 0.01223 | -0.441 | -0.02936 | 0.01858 | fixed |
| count_birth_order3/4 | 0.009254 | 0.01289 | 0.7177 | -0.01602 | 0.03453 | fixed |
| count_birth_order4/4 | 0.02237 | 0.01388 | 1.612 | -0.004829 | 0.04958 | fixed |
| count_birth_order1/5 | 0.005794 | 0.01286 | 0.4507 | -0.0194 | 0.03099 | fixed |
| count_birth_order2/5 | 0.009803 | 0.01365 | 0.7183 | -0.01694 | 0.03655 | fixed |
| count_birth_order3/5 | 0.007786 | 0.01435 | 0.5424 | -0.02035 | 0.03592 | fixed |
| count_birth_order4/5 | 0.01815 | 0.01515 | 1.198 | -0.01154 | 0.04784 | fixed |
| count_birth_order5/5 | 0.01756 | 0.01518 | 1.157 | -0.01219 | 0.04732 | fixed |
| count_birth_order1/5+ | 0.01252 | 0.009942 | 1.259 | -0.006965 | 0.03201 | fixed |
| count_birth_order2/5+ | -0.01148 | 0.01033 | -1.111 | -0.03173 | 0.008772 | fixed |
| count_birth_order3/5+ | 0.007394 | 0.01023 | 0.723 | -0.01265 | 0.02744 | fixed |
| count_birth_order4/5+ | 0.01005 | 0.01002 | 1.003 | -0.009592 | 0.02969 | fixed |
| count_birth_order5/5+ | 0.001259 | 0.01013 | 0.1243 | -0.01859 | 0.02111 | fixed |
| count_birth_order5+/5+ | 0.007163 | 0.0082 | 0.8736 | -0.008909 | 0.02324 | fixed |
| sd_(Intercept).mother_pidlink | 0.05892 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1712 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -5714 | -5635 | 2868 | -5736 | NA | NA | NA |
| 12 | -5712 | -5626 | 2868 | -5736 | 0.4579 | 1 | 0.4986 |
| 16 | -5707 | -5592 | 2870 | -5739 | 3.207 | 4 | 0.5238 |
| 26 | -5703 | -5517 | 2878 | -5755 | 16.09 | 10 | 0.09704 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.0135 | 0.1052 | -0.1283 | -0.2197 | 0.1927 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0004965 | 0.01128 | 0.044 | -0.02162 | 0.02261 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00002584 | 0.0003865 | 0.06685 | -0.0007317 | 0.0007834 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000008291 | 0.000004237 | -0.1957 | -0.000009134 | 0.000007476 | fixed |
| male | 0.02643 | 0.005311 | 4.977 | 0.01602 | 0.03684 | fixed |
| sibling_count3 | 0.01414 | 0.008772 | 1.612 | -0.003053 | 0.03133 | fixed |
| sibling_count4 | 0.01755 | 0.00906 | 1.937 | -0.0002053 | 0.03531 | fixed |
| sibling_count5 | 0.004679 | 0.0101 | 0.4631 | -0.01512 | 0.02448 | fixed |
| sibling_count5+ | 0.01454 | 0.008725 | 1.666 | -0.002565 | 0.03164 | fixed |
| sd_(Intercept).mother_pidlink | 0.05107 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1508 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01511 | 0.1052 | -0.1436 | -0.2213 | 0.1911 | fixed |
| birth_order | -0.00126 | 0.001647 | -0.7652 | -0.004487 | 0.001967 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0008181 | 0.01129 | 0.07246 | -0.02131 | 0.02295 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00001765 | 0.0003867 | 0.04563 | -0.0007403 | 0.0007755 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000007941 | 0.000004238 | -0.1874 | -0.0000091 | 0.000007512 | fixed |
| male | 0.02649 | 0.005312 | 4.987 | 0.01608 | 0.0369 | fixed |
| sibling_count3 | 0.01478 | 0.008814 | 1.676 | -0.002499 | 0.03205 | fixed |
| sibling_count4 | 0.01895 | 0.009244 | 2.05 | 0.000829 | 0.03706 | fixed |
| sibling_count5 | 0.006955 | 0.01054 | 0.6599 | -0.0137 | 0.02761 | fixed |
| sibling_count5+ | 0.01908 | 0.01055 | 1.809 | -0.001596 | 0.03975 | fixed |
| sd_(Intercept).mother_pidlink | 0.05147 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1506 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01618 | 0.1053 | -0.1537 | -0.2226 | 0.1902 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.00098 | 0.01129 | 0.08678 | -0.02115 | 0.02311 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0000145 | 0.0003868 | 0.03749 | -0.0007437 | 0.0007727 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000007877 | 0.00000424 | -0.1858 | -0.000009099 | 0.000007523 | fixed |
| male | 0.02645 | 0.005314 | 4.978 | 0.01604 | 0.03687 | fixed |
| sibling_count3 | 0.01569 | 0.008983 | 1.747 | -0.001915 | 0.0333 | fixed |
| sibling_count4 | 0.02248 | 0.009577 | 2.347 | 0.003705 | 0.04125 | fixed |
| sibling_count5 | 0.01117 | 0.01103 | 1.013 | -0.01044 | 0.03278 | fixed |
| sibling_count5+ | 0.02095 | 0.01082 | 1.936 | -0.0002616 | 0.04216 | fixed |
| birth_order_nonlinear2 | -0.008145 | 0.007027 | -1.159 | -0.02192 | 0.005629 | fixed |
| birth_order_nonlinear3 | -0.006853 | 0.008248 | -0.8308 | -0.02302 | 0.009314 | fixed |
| birth_order_nonlinear4 | -0.01932 | 0.01007 | -1.919 | -0.03906 | 0.0004151 | fixed |
| birth_order_nonlinear5 | -0.01062 | 0.01235 | -0.8596 | -0.03483 | 0.01359 | fixed |
| birth_order_nonlinear5+ | -0.007731 | 0.01221 | -0.6332 | -0.03166 | 0.0162 | fixed |
| sd_(Intercept).mother_pidlink | 0.05144 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1507 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.009966 | 0.1058 | -0.09421 | -0.2173 | 0.1974 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0004782 | 0.01135 | 0.04215 | -0.02176 | 0.02272 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00003556 | 0.0003887 | 0.09147 | -0.0007264 | 0.0007975 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000001051 | 0.000004262 | -0.2466 | -0.000009405 | 0.000007303 | fixed |
| male | 0.0264 | 0.005325 | 4.957 | 0.01596 | 0.03683 | fixed |
| count_birth_order2/2 | -0.01641 | 0.01373 | -1.195 | -0.04332 | 0.0105 | fixed |
| count_birth_order1/3 | 0.00795 | 0.01153 | 0.6896 | -0.01465 | 0.03055 | fixed |
| count_birth_order2/3 | 0.0165 | 0.01281 | 1.288 | -0.00861 | 0.04161 | fixed |
| count_birth_order3/3 | 0.0005857 | 0.01395 | 0.04198 | -0.02676 | 0.02793 | fixed |
| count_birth_order1/4 | 0.0207 | 0.01322 | 1.565 | -0.005221 | 0.04661 | fixed |
| count_birth_order2/4 | 0.005796 | 0.01401 | 0.4136 | -0.02167 | 0.03326 | fixed |
| count_birth_order3/4 | 0.008942 | 0.01453 | 0.6155 | -0.01953 | 0.03742 | fixed |
| count_birth_order4/4 | 0.01142 | 0.01555 | 0.734 | -0.01907 | 0.0419 | fixed |
| count_birth_order1/5 | 0.007885 | 0.01741 | 0.4528 | -0.02624 | 0.04201 | fixed |
| count_birth_order2/5 | -0.006315 | 0.01877 | -0.3363 | -0.04311 | 0.03048 | fixed |
| count_birth_order3/5 | 0.008757 | 0.01785 | 0.4907 | -0.02622 | 0.04373 | fixed |
| count_birth_order4/5 | -0.01357 | 0.01741 | -0.7797 | -0.04769 | 0.02054 | fixed |
| count_birth_order5/5 | -0.0001377 | 0.01832 | -0.007518 | -0.03604 | 0.03576 | fixed |
| count_birth_order1/5+ | 0.02285 | 0.01649 | 1.385 | -0.009476 | 0.05517 | fixed |
| count_birth_order2/5+ | 0.008602 | 0.01661 | 0.5177 | -0.02396 | 0.04116 | fixed |
| count_birth_order3/5+ | 0.01917 | 0.01621 | 1.182 | -0.01261 | 0.05094 | fixed |
| count_birth_order4/5+ | -0.01033 | 0.01587 | -0.651 | -0.04143 | 0.02077 | fixed |
| count_birth_order5/5+ | 0.006311 | 0.01516 | 0.4162 | -0.02341 | 0.03603 | fixed |
| count_birth_order5+/5+ | 0.01036 | 0.01186 | 0.8735 | -0.01289 | 0.03362 | fixed |
| sd_(Intercept).mother_pidlink | 0.05117 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1509 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -3080 | -3011 | 1551 | -3102 | NA | NA | NA |
| 12 | -3078 | -3004 | 1551 | -3102 | 0.5788 | 1 | 0.4468 |
| 16 | -3074 | -2975 | 1553 | -3106 | 3.483 | 4 | 0.4804 |
| 26 | -3059 | -2897 | 1555 | -3111 | 4.848 | 10 | 0.9011 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01139 | 0.1044 | -0.1092 | -0.216 | 0.1932 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0004498 | 0.0112 | 0.04014 | -0.02151 | 0.02241 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00002628 | 0.000384 | 0.06844 | -0.0007263 | 0.0007788 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000008199 | 0.00000421 | -0.1948 | -0.000009072 | 0.000007432 | fixed |
| male | 0.02609 | 0.005275 | 4.946 | 0.01575 | 0.03643 | fixed |
| sibling_count3 | 0.008191 | 0.009579 | 0.8551 | -0.01058 | 0.02697 | fixed |
| sibling_count4 | 0.02248 | 0.009664 | 2.326 | 0.003539 | 0.04142 | fixed |
| sibling_count5 | -0.0006205 | 0.01018 | -0.06093 | -0.02058 | 0.01934 | fixed |
| sibling_count5+ | 0.01265 | 0.008926 | 1.417 | -0.00485 | 0.03014 | fixed |
| sd_(Intercept).mother_pidlink | 0.05052 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1503 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01242 | 0.1044 | -0.119 | -0.217 | 0.1922 | fixed |
| birth_order | -0.0009043 | 0.001448 | -0.6243 | -0.003743 | 0.001934 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0006657 | 0.01121 | 0.05938 | -0.02131 | 0.02264 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00002094 | 0.0003841 | 0.05452 | -0.0007318 | 0.0007737 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000008013 | 0.000004211 | -0.1903 | -0.000009054 | 0.000007451 | fixed |
| male | 0.02613 | 0.005276 | 4.953 | 0.01579 | 0.03647 | fixed |
| sibling_count3 | 0.008654 | 0.00961 | 0.9005 | -0.01018 | 0.02749 | fixed |
| sibling_count4 | 0.0234 | 0.009779 | 2.393 | 0.004236 | 0.04257 | fixed |
| sibling_count5 | 0.000899 | 0.01048 | 0.08581 | -0.01964 | 0.02143 | fixed |
| sibling_count5+ | 0.01586 | 0.0103 | 1.54 | -0.004323 | 0.03603 | fixed |
| sd_(Intercept).mother_pidlink | 0.05085 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1502 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01457 | 0.1045 | -0.1394 | -0.2194 | 0.1902 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.000977 | 0.01121 | 0.08712 | -0.021 | 0.02296 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00001225 | 0.0003842 | 0.03189 | -0.0007408 | 0.0007653 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000007374 | 0.000004213 | -0.175 | -0.000008995 | 0.00000752 | fixed |
| male | 0.0261 | 0.005277 | 4.946 | 0.01575 | 0.03644 | fixed |
| sibling_count3 | 0.009587 | 0.00977 | 0.9813 | -0.009562 | 0.02874 | fixed |
| sibling_count4 | 0.02691 | 0.01006 | 2.674 | 0.007189 | 0.04663 | fixed |
| sibling_count5 | 0.004979 | 0.01093 | 0.4555 | -0.01644 | 0.0264 | fixed |
| sibling_count5+ | 0.01859 | 0.01059 | 1.755 | -0.002169 | 0.03936 | fixed |
| birth_order_nonlinear2 | -0.006724 | 0.007086 | -0.9489 | -0.02061 | 0.007165 | fixed |
| birth_order_nonlinear3 | -0.00603 | 0.008265 | -0.7296 | -0.02223 | 0.01017 | fixed |
| birth_order_nonlinear4 | -0.01962 | 0.009795 | -2.003 | -0.03882 | -0.0004223 | fixed |
| birth_order_nonlinear5 | -0.008111 | 0.01193 | -0.6798 | -0.0315 | 0.01527 | fixed |
| birth_order_nonlinear5+ | -0.007123 | 0.01101 | -0.6469 | -0.02871 | 0.01446 | fixed |
| sd_(Intercept).mother_pidlink | 0.05104 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1502 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01177 | 0.1048 | -0.1123 | -0.2172 | 0.1936 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0009535 | 0.01125 | 0.08475 | -0.0211 | 0.023 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00001652 | 0.0003856 | 0.04284 | -0.0007392 | 0.0007723 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000000813 | 0.000004229 | -0.1922 | -0.000009102 | 0.000007476 | fixed |
| male | 0.02624 | 0.005288 | 4.961 | 0.01587 | 0.0366 | fixed |
| count_birth_order2/2 | -0.01773 | 0.01501 | -1.182 | -0.04714 | 0.01168 | fixed |
| count_birth_order1/3 | -0.0005947 | 0.0127 | -0.04683 | -0.02549 | 0.0243 | fixed |
| count_birth_order2/3 | 0.01466 | 0.01383 | 1.06 | -0.01244 | 0.04177 | fixed |
| count_birth_order3/3 | -0.009318 | 0.01532 | -0.608 | -0.03935 | 0.02072 | fixed |
| count_birth_order1/4 | 0.03084 | 0.01378 | 2.238 | 0.003834 | 0.05785 | fixed |
| count_birth_order2/4 | 0.009355 | 0.01452 | 0.6444 | -0.0191 | 0.03781 | fixed |
| count_birth_order3/4 | 0.01186 | 0.01571 | 0.7549 | -0.01893 | 0.04265 | fixed |
| count_birth_order4/4 | 0.006457 | 0.01706 | 0.3785 | -0.02698 | 0.0399 | fixed |
| count_birth_order1/5 | 0.0004113 | 0.01665 | 0.0247 | -0.03223 | 0.03305 | fixed |
| count_birth_order2/5 | -0.01248 | 0.01707 | -0.731 | -0.04594 | 0.02098 | fixed |
| count_birth_order3/5 | -0.004494 | 0.01756 | -0.2559 | -0.03891 | 0.02992 | fixed |
| count_birth_order4/5 | -0.01346 | 0.01788 | -0.753 | -0.0485 | 0.02157 | fixed |
| count_birth_order5/5 | -0.002927 | 0.01815 | -0.1613 | -0.0385 | 0.03264 | fixed |
| count_birth_order1/5+ | 0.009889 | 0.01503 | 0.6581 | -0.01956 | 0.03934 | fixed |
| count_birth_order2/5+ | 0.007599 | 0.01587 | 0.4788 | -0.0235 | 0.0387 | fixed |
| count_birth_order3/5+ | 0.02187 | 0.01529 | 1.43 | -0.008095 | 0.05183 | fixed |
| count_birth_order4/5+ | -0.009521 | 0.01485 | -0.6411 | -0.03863 | 0.01959 | fixed |
| count_birth_order5/5+ | 0.004109 | 0.01572 | 0.2613 | -0.02671 | 0.03493 | fixed |
| count_birth_order5+/5+ | 0.00764 | 0.01189 | 0.6425 | -0.01566 | 0.03094 | fixed |
| sd_(Intercept).mother_pidlink | 0.05089 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1503 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -3126 | -3058 | 1574 | -3148 | NA | NA | NA |
| 12 | -3125 | -3050 | 1574 | -3149 | 0.3851 | 1 | 0.5349 |
| 16 | -3121 | -3021 | 1576 | -3153 | 3.745 | 4 | 0.4416 |
| 26 | -3108 | -2946 | 1580 | -3160 | 6.999 | 10 | 0.7256 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01066 | 0.1071 | -0.09954 | -0.2206 | 0.1993 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0003278 | 0.01151 | 0.02848 | -0.02223 | 0.02289 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00003105 | 0.0003947 | 0.07867 | -0.0007425 | 0.0008046 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000008807 | 0.000004332 | -0.2033 | -0.000009371 | 0.000007609 | fixed |
| male | 0.02676 | 0.005405 | 4.952 | 0.01617 | 0.03736 | fixed |
| sibling_count3 | 0.01389 | 0.008671 | 1.602 | -0.003107 | 0.03088 | fixed |
| sibling_count4 | 0.01566 | 0.009086 | 1.723 | -0.002149 | 0.03347 | fixed |
| sibling_count5 | 0.003031 | 0.01042 | 0.2908 | -0.0174 | 0.02346 | fixed |
| sibling_count5+ | 0.01426 | 0.008852 | 1.611 | -0.003091 | 0.03161 | fixed |
| sd_(Intercept).mother_pidlink | 0.05302 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1516 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01296 | 0.1072 | -0.1209 | -0.223 | 0.1971 | fixed |
| birth_order | -0.001449 | 0.001711 | -0.8467 | -0.004802 | 0.001905 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.00075 | 0.01152 | 0.0651 | -0.02183 | 0.02333 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00001983 | 0.0003949 | 0.05021 | -0.0007542 | 0.0007938 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000008209 | 0.000004332 | -0.1895 | -0.000009312 | 0.00000767 | fixed |
| male | 0.02679 | 0.005405 | 4.957 | 0.0162 | 0.03738 | fixed |
| sibling_count3 | 0.01463 | 0.008718 | 1.679 | -0.002453 | 0.03172 | fixed |
| sibling_count4 | 0.01724 | 0.009279 | 1.858 | -0.0009443 | 0.03543 | fixed |
| sibling_count5 | 0.005559 | 0.01085 | 0.5122 | -0.01571 | 0.02683 | fixed |
| sibling_count5+ | 0.01948 | 0.01078 | 1.806 | -0.00166 | 0.04061 | fixed |
| sd_(Intercept).mother_pidlink | 0.05347 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1514 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01281 | 0.1072 | -0.1194 | -0.223 | 0.1974 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0007721 | 0.01152 | 0.06702 | -0.02181 | 0.02335 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0000206 | 0.0003949 | 0.05216 | -0.0007535 | 0.0007947 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000000849 | 0.000004334 | -0.1959 | -0.000009343 | 0.000007645 | fixed |
| male | 0.02683 | 0.005405 | 4.963 | 0.01623 | 0.03742 | fixed |
| sibling_count3 | 0.01413 | 0.008893 | 1.588 | -0.003304 | 0.03156 | fixed |
| sibling_count4 | 0.01947 | 0.009615 | 2.025 | 0.0006293 | 0.03832 | fixed |
| sibling_count5 | 0.009835 | 0.01131 | 0.8699 | -0.01232 | 0.03199 | fixed |
| sibling_count5+ | 0.02072 | 0.01108 | 1.871 | -0.0009908 | 0.04243 | fixed |
| birth_order_nonlinear2 | -0.007982 | 0.007046 | -1.133 | -0.02179 | 0.005828 | fixed |
| birth_order_nonlinear3 | -0.001416 | 0.008319 | -0.1702 | -0.01772 | 0.01489 | fixed |
| birth_order_nonlinear4 | -0.02045 | 0.01045 | -1.957 | -0.04093 | 0.00002855 | fixed |
| birth_order_nonlinear5 | -0.01796 | 0.01288 | -1.395 | -0.04321 | 0.007276 | fixed |
| birth_order_nonlinear5+ | -0.006144 | 0.0127 | -0.4838 | -0.03104 | 0.01875 | fixed |
| sd_(Intercept).mother_pidlink | 0.0534 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1514 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.01112 | 0.1077 | -0.1032 | -0.2222 | 0.2 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0006036 | 0.01157 | 0.05216 | -0.02208 | 0.02328 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00002941 | 0.0003968 | 0.07411 | -0.0007484 | 0.0008072 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000009731 | 0.000004356 | -0.2234 | -0.00000951 | 0.000007564 | fixed |
| male | 0.02685 | 0.005417 | 4.956 | 0.01623 | 0.03747 | fixed |
| count_birth_order2/2 | -0.01103 | 0.01345 | -0.8202 | -0.03738 | 0.01533 | fixed |
| count_birth_order1/3 | 0.007516 | 0.01142 | 0.658 | -0.01487 | 0.0299 | fixed |
| count_birth_order2/3 | 0.01549 | 0.0127 | 1.22 | -0.009394 | 0.04038 | fixed |
| count_birth_order3/3 | 0.009049 | 0.01367 | 0.6619 | -0.01774 | 0.03584 | fixed |
| count_birth_order1/4 | 0.02297 | 0.0134 | 1.714 | -0.003294 | 0.04924 | fixed |
| count_birth_order2/4 | 0.0009928 | 0.01407 | 0.07055 | -0.02659 | 0.02857 | fixed |
| count_birth_order3/4 | 0.01526 | 0.0146 | 1.045 | -0.01335 | 0.04388 | fixed |
| count_birth_order4/4 | 0.005978 | 0.01586 | 0.3769 | -0.02511 | 0.03706 | fixed |
| count_birth_order1/5 | 0.007985 | 0.01752 | 0.4559 | -0.02634 | 0.04231 | fixed |
| count_birth_order2/5 | -0.005466 | 0.01954 | -0.2797 | -0.04377 | 0.03284 | fixed |
| count_birth_order3/5 | 0.01416 | 0.01906 | 0.7431 | -0.02319 | 0.05151 | fixed |
| count_birth_order4/5 | -0.01167 | 0.01834 | -0.636 | -0.04762 | 0.02429 | fixed |
| count_birth_order5/5 | -0.009098 | 0.01948 | -0.467 | -0.04728 | 0.02909 | fixed |
| count_birth_order1/5+ | 0.02622 | 0.01707 | 1.536 | -0.007235 | 0.05967 | fixed |
| count_birth_order2/5+ | 0.01201 | 0.01725 | 0.6963 | -0.0218 | 0.04582 | fixed |
| count_birth_order3/5+ | 0.02036 | 0.01647 | 1.236 | -0.01192 | 0.05263 | fixed |
| count_birth_order4/5+ | -0.009475 | 0.01653 | -0.573 | -0.04188 | 0.02293 | fixed |
| count_birth_order5/5+ | 0.00164 | 0.01552 | 0.1056 | -0.02879 | 0.03207 | fixed |
| count_birth_order5+/5+ | 0.01344 | 0.01213 | 1.108 | -0.01033 | 0.0372 | fixed |
| sd_(Intercept).mother_pidlink | 0.05348 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1516 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -2965 | -2897 | 1493 | -2987 | NA | NA | NA |
| 12 | -2963 | -2889 | 1494 | -2987 | 0.7092 | 1 | 0.3997 |
| 16 | -2960 | -2861 | 1496 | -2992 | 4.896 | 4 | 0.2981 |
| 26 | -2944 | -2783 | 1498 | -2996 | 3.888 | 10 | 0.9523 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = `Sector_Transportation, storage and communications`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.0652 | 0.04159 | 1.568 | -0.01631 | 0.1467 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.003102 | 0.003721 | -0.8336 | -0.01039 | 0.004191 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00007889 | 0.0001042 | 0.7573 | -0.0001253 | 0.0002831 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000005583 | 0.0000009226 | -0.6052 | -0.000002367 | 0.00000125 | fixed |
| male | -0.01246 | 0.003874 | -3.218 | -0.02006 | -0.004872 | fixed |
| sibling_count3 | 0.008001 | 0.007939 | 1.008 | -0.00756 | 0.02356 | fixed |
| sibling_count4 | 0.009834 | 0.008 | 1.229 | -0.005846 | 0.02551 | fixed |
| sibling_count5 | 0.02201 | 0.008298 | 2.653 | 0.005748 | 0.03828 | fixed |
| sibling_count5+ | 0.01792 | 0.00647 | 2.769 | 0.005236 | 0.0306 | fixed |
| sd_(Intercept).mother_pidlink | 0.04837 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1826 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.06522 | 0.04159 | 1.568 | -0.01629 | 0.1467 | fixed |
| birth_order | 0.0004447 | 0.0007746 | 0.5741 | -0.001073 | 0.001963 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.003224 | 0.003727 | -0.865 | -0.01053 | 0.004081 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00008323 | 0.0001044 | 0.7969 | -0.0001215 | 0.0002879 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000000597 | 0.0000009251 | -0.6454 | -0.00000241 | 0.000001216 | fixed |
| male | -0.01247 | 0.003874 | -3.22 | -0.02007 | -0.004883 | fixed |
| sibling_count3 | 0.007879 | 0.007942 | 0.992 | -0.007687 | 0.02345 | fixed |
| sibling_count4 | 0.00955 | 0.008016 | 1.191 | -0.006161 | 0.02526 | fixed |
| sibling_count5 | 0.02153 | 0.008341 | 2.581 | 0.005178 | 0.03788 | fixed |
| sibling_count5+ | 0.01634 | 0.007032 | 2.323 | 0.002554 | 0.03012 | fixed |
| sd_(Intercept).mother_pidlink | 0.04838 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1826 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.06535 | 0.04165 | 1.569 | -0.01629 | 0.147 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.003216 | 0.00373 | -0.8623 | -0.01053 | 0.004095 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0000849 | 0.0001045 | 0.8124 | -0.0001199 | 0.0002897 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000006214 | 0.0000009255 | -0.6715 | -0.000002435 | 0.000001192 | fixed |
| male | -0.01255 | 0.003874 | -3.241 | -0.02015 | -0.004962 | fixed |
| sibling_count3 | 0.007229 | 0.008066 | 0.8962 | -0.008581 | 0.02304 | fixed |
| sibling_count4 | 0.01056 | 0.008249 | 1.28 | -0.005609 | 0.02673 | fixed |
| sibling_count5 | 0.02083 | 0.008646 | 2.409 | 0.00388 | 0.03777 | fixed |
| sibling_count5+ | 0.01412 | 0.007382 | 1.913 | -0.0003453 | 0.02859 | fixed |
| birth_order_nonlinear2 | -0.001514 | 0.005678 | -0.2667 | -0.01264 | 0.009615 | fixed |
| birth_order_nonlinear3 | 0.003304 | 0.006598 | 0.5007 | -0.009628 | 0.01623 | fixed |
| birth_order_nonlinear4 | -0.007857 | 0.007416 | -1.06 | -0.02239 | 0.006677 | fixed |
| birth_order_nonlinear5 | 0.01102 | 0.008329 | 1.324 | -0.005301 | 0.02735 | fixed |
| birth_order_nonlinear5+ | 0.007088 | 0.006857 | 1.034 | -0.006351 | 0.02053 | fixed |
| sd_(Intercept).mother_pidlink | 0.04841 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1826 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.06713 | 0.04182 | 1.605 | -0.01484 | 0.1491 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.003226 | 0.003735 | -0.8637 | -0.01055 | 0.004095 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.00008514 | 0.0001046 | 0.8139 | -0.0001199 | 0.0002902 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.0000006217 | 0.0000009261 | -0.6713 | -0.000002437 | 0.000001193 | fixed |
| male | -0.01247 | 0.003877 | -3.216 | -0.02007 | -0.004869 | fixed |
| count_birth_order2/2 | -0.006295 | 0.01132 | -0.556 | -0.02849 | 0.0159 | fixed |
| count_birth_order1/3 | 0.003135 | 0.01083 | 0.2896 | -0.01808 | 0.02435 | fixed |
| count_birth_order2/3 | 0.00541 | 0.01204 | 0.4493 | -0.01819 | 0.02901 | fixed |
| count_birth_order3/3 | 0.01109 | 0.01322 | 0.8389 | -0.01482 | 0.03701 | fixed |
| count_birth_order1/4 | 0.01225 | 0.01192 | 1.028 | -0.0111 | 0.03561 | fixed |
| count_birth_order2/4 | 0.00659 | 0.01278 | 0.5156 | -0.01846 | 0.03164 | fixed |
| count_birth_order3/4 | 0.01458 | 0.01348 | 1.082 | -0.01184 | 0.041 | fixed |
| count_birth_order4/4 | -0.007248 | 0.01451 | -0.4995 | -0.03569 | 0.02119 | fixed |
| count_birth_order1/5 | 0.004284 | 0.01344 | 0.3188 | -0.02206 | 0.03063 | fixed |
| count_birth_order2/5 | 0.02675 | 0.01427 | 1.875 | -0.001216 | 0.05471 | fixed |
| count_birth_order3/5 | 0.0287 | 0.01501 | 1.912 | -0.0007223 | 0.05813 | fixed |
| count_birth_order4/5 | 0.008712 | 0.01585 | 0.5497 | -0.02235 | 0.03978 | fixed |
| count_birth_order5/5 | 0.03591 | 0.01588 | 2.261 | 0.004787 | 0.06703 | fixed |
| count_birth_order1/5+ | 0.0164 | 0.0104 | 1.577 | -0.003981 | 0.03677 | fixed |
| count_birth_order2/5+ | 0.008682 | 0.01081 | 0.8033 | -0.0125 | 0.02987 | fixed |
| count_birth_order3/5+ | 0.01101 | 0.0107 | 1.029 | -0.00996 | 0.03198 | fixed |
| count_birth_order4/5+ | 0.008169 | 0.01048 | 0.7795 | -0.01237 | 0.02871 | fixed |
| count_birth_order5/5+ | 0.02166 | 0.01059 | 2.044 | 0.0008929 | 0.04242 | fixed |
| count_birth_order5+/5+ | 0.01945 | 0.008525 | 2.281 | 0.00274 | 0.03616 | fixed |
| sd_(Intercept).mother_pidlink | 0.04833 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1826 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -4846 | -4767 | 2434 | -4868 | NA | NA | NA |
| 12 | -4844 | -4758 | 2434 | -4868 | 0.33 | 1 | 0.5656 |
| 16 | -4842 | -4727 | 2437 | -4874 | 5.859 | 4 | 0.2099 |
| 26 | -4827 | -4640 | 2439 | -4879 | 4.714 | 10 | 0.9094 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.147 | 0.1226 | 1.199 | -0.09325 | 0.3872 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01108 | 0.01315 | -0.8429 | -0.03685 | 0.01468 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0003627 | 0.0004503 | 0.8054 | -0.0005199 | 0.001245 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000004015 | 0.000004936 | -0.8135 | -0.00001369 | 0.000005658 | fixed |
| male | -0.016 | 0.006199 | -2.581 | -0.02815 | -0.003849 | fixed |
| sibling_count3 | 0.004867 | 0.01008 | 0.4826 | -0.0149 | 0.02463 | fixed |
| sibling_count4 | 0.006221 | 0.01038 | 0.5992 | -0.01413 | 0.02657 | fixed |
| sibling_count5 | 0.0261 | 0.01153 | 2.264 | 0.003508 | 0.0487 | fixed |
| sibling_count5+ | 0.01793 | 0.009949 | 1.802 | -0.001569 | 0.03743 | fixed |
| sd_(Intercept).mother_pidlink | 0.03293 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1823 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1438 | 0.1225 | 1.173 | -0.09643 | 0.3839 | fixed |
| birth_order | -0.00308 | 0.001903 | -1.618 | -0.006811 | 0.0006507 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01039 | 0.01315 | -0.7901 | -0.03616 | 0.01538 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0003461 | 0.0004503 | 0.7686 | -0.0005365 | 0.001229 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000003965 | 0.000004934 | -0.8035 | -0.00001364 | 0.000005707 | fixed |
| male | -0.01587 | 0.006198 | -2.56 | -0.02802 | -0.003722 | fixed |
| sibling_count3 | 0.006395 | 0.01013 | 0.6316 | -0.01345 | 0.02624 | fixed |
| sibling_count4 | 0.009575 | 0.01058 | 0.9046 | -0.01117 | 0.03032 | fixed |
| sibling_count5 | 0.03163 | 0.01202 | 2.632 | 0.008072 | 0.05518 | fixed |
| sibling_count5+ | 0.0289 | 0.01203 | 2.401 | 0.005311 | 0.05249 | fixed |
| sd_(Intercept).mother_pidlink | 0.03253 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1823 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1472 | 0.1227 | 1.2 | -0.09317 | 0.3876 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.0108 | 0.01315 | -0.821 | -0.03658 | 0.01498 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0003645 | 0.0004505 | 0.809 | -0.0005185 | 0.001247 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00000422 | 0.000004938 | -0.8547 | -0.0000139 | 0.000005457 | fixed |
| male | -0.01611 | 0.006201 | -2.598 | -0.02826 | -0.003957 | fixed |
| sibling_count3 | 0.007144 | 0.01033 | 0.6914 | -0.01311 | 0.0274 | fixed |
| sibling_count4 | 0.01067 | 0.01099 | 0.971 | -0.01087 | 0.03222 | fixed |
| sibling_count5 | 0.03423 | 0.01262 | 2.713 | 0.009498 | 0.05897 | fixed |
| sibling_count5+ | 0.03208 | 0.01238 | 2.592 | 0.007826 | 0.05634 | fixed |
| birth_order_nonlinear2 | -0.01406 | 0.008281 | -1.698 | -0.03029 | 0.002167 | fixed |
| birth_order_nonlinear3 | -0.01005 | 0.009708 | -1.035 | -0.02908 | 0.008976 | fixed |
| birth_order_nonlinear4 | -0.01388 | 0.01184 | -1.172 | -0.03708 | 0.009328 | fixed |
| birth_order_nonlinear5 | -0.02517 | 0.01452 | -1.734 | -0.05363 | 0.003279 | fixed |
| birth_order_nonlinear5+ | -0.02715 | 0.01418 | -1.915 | -0.05495 | 0.0006431 | fixed |
| sd_(Intercept).mother_pidlink | 0.03234 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1824 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1428 | 0.1231 | 1.16 | -0.0985 | 0.3841 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01111 | 0.01321 | -0.8416 | -0.037 | 0.01477 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0003788 | 0.0004524 | 0.8374 | -0.0005079 | 0.001266 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000004428 | 0.00000496 | -0.8929 | -0.00001415 | 0.000005292 | fixed |
| male | -0.0164 | 0.00621 | -2.64 | -0.02857 | -0.004225 | fixed |
| count_birth_order2/2 | 0.006857 | 0.01616 | 0.4242 | -0.02482 | 0.03853 | fixed |
| count_birth_order1/3 | 0.009847 | 0.01342 | 0.7337 | -0.01646 | 0.03615 | fixed |
| count_birth_order2/3 | -0.0002712 | 0.01492 | -0.01818 | -0.02952 | 0.02898 | fixed |
| count_birth_order3/3 | 0.01219 | 0.01626 | 0.7498 | -0.01968 | 0.04407 | fixed |
| count_birth_order1/4 | 0.02105 | 0.0154 | 1.367 | -0.009128 | 0.05123 | fixed |
| count_birth_order2/4 | 0.009409 | 0.01633 | 0.5762 | -0.02259 | 0.04141 | fixed |
| count_birth_order3/4 | 0.0003186 | 0.01694 | 0.01881 | -0.03288 | 0.03351 | fixed |
| count_birth_order4/4 | -0.001352 | 0.01813 | -0.07459 | -0.03689 | 0.03418 | fixed |
| count_birth_order1/5 | 0.04666 | 0.02029 | 2.3 | 0.006901 | 0.08642 | fixed |
| count_birth_order2/5 | 0.0226 | 0.02189 | 1.032 | -0.02031 | 0.06551 | fixed |
| count_birth_order3/5 | 0.03762 | 0.02081 | 1.808 | -0.003166 | 0.07842 | fixed |
| count_birth_order4/5 | 0.02517 | 0.0203 | 1.24 | -0.01462 | 0.06497 | fixed |
| count_birth_order5/5 | 0.009177 | 0.02137 | 0.4294 | -0.03271 | 0.05106 | fixed |
| count_birth_order1/5+ | 0.06168 | 0.0192 | 3.212 | 0.02405 | 0.09932 | fixed |
| count_birth_order2/5+ | -0.002437 | 0.01937 | -0.1258 | -0.04039 | 0.03552 | fixed |
| count_birth_order3/5+ | 0.02147 | 0.0189 | 1.136 | -0.01558 | 0.05852 | fixed |
| count_birth_order4/5+ | 0.03178 | 0.01851 | 1.717 | -0.004493 | 0.06806 | fixed |
| count_birth_order5/5+ | 0.01785 | 0.01769 | 1.009 | -0.01682 | 0.05252 | fixed |
| count_birth_order5+/5+ | 0.01175 | 0.01371 | 0.8568 | -0.01513 | 0.03863 | fixed |
| sd_(Intercept).mother_pidlink | 0.0318 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1825 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -1951 | -1883 | 986.6 | -1973 | NA | NA | NA |
| 12 | -1952 | -1877 | 987.9 | -1976 | 2.627 | 1 | 0.105 |
| 16 | -1947 | -1848 | 989.5 | -1979 | 3.289 | 4 | 0.5106 |
| 26 | -1936 | -1774 | 993.8 | -1988 | 8.507 | 10 | 0.5795 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1348 | 0.122 | 1.105 | -0.1043 | 0.3739 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01021 | 0.0131 | -0.7795 | -0.03588 | 0.01546 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0003311 | 0.0004488 | 0.7378 | -0.0005485 | 0.001211 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000003669 | 0.00000492 | -0.7457 | -0.00001331 | 0.000005974 | fixed |
| male | -0.0162 | 0.006178 | -2.622 | -0.0283 | -0.004088 | fixed |
| sibling_count3 | 0.009527 | 0.01106 | 0.8615 | -0.01215 | 0.0312 | fixed |
| sibling_count4 | 0.006535 | 0.01113 | 0.5869 | -0.01529 | 0.02836 | fixed |
| sibling_count5 | 0.0336 | 0.0117 | 2.872 | 0.01067 | 0.05653 | fixed |
| sibling_count5+ | 0.02293 | 0.01026 | 2.235 | 0.002817 | 0.04304 | fixed |
| sd_(Intercept).mother_pidlink | 0.03225 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1824 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.133 | 0.122 | 1.09 | -0.1061 | 0.3721 | fixed |
| birth_order | -0.002138 | 0.001677 | -1.275 | -0.005425 | 0.001148 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.009771 | 0.0131 | -0.7458 | -0.03545 | 0.01591 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.000321 | 0.0004488 | 0.7153 | -0.0005586 | 0.001201 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00000365 | 0.00000492 | -0.7418 | -0.00001329 | 0.000005993 | fixed |
| male | -0.01611 | 0.006178 | -2.607 | -0.02822 | -0.003998 | fixed |
| sibling_count3 | 0.0106 | 0.01109 | 0.9557 | -0.01114 | 0.03233 | fixed |
| sibling_count4 | 0.008674 | 0.01126 | 0.7704 | -0.01339 | 0.03074 | fixed |
| sibling_count5 | 0.03718 | 0.01203 | 3.091 | 0.0136 | 0.06076 | fixed |
| sibling_count5+ | 0.03044 | 0.01183 | 2.573 | 0.007253 | 0.05362 | fixed |
| sd_(Intercept).mother_pidlink | 0.03218 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1824 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1407 | 0.1221 | 1.152 | -0.09868 | 0.38 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.01045 | 0.01311 | -0.797 | -0.03613 | 0.01524 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0003477 | 0.000449 | 0.7743 | -0.0005324 | 0.001228 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00000398 | 0.000004923 | -0.8085 | -0.00001363 | 0.000005669 | fixed |
| male | -0.01637 | 0.006179 | -2.649 | -0.02848 | -0.004261 | fixed |
| sibling_count3 | 0.01284 | 0.01128 | 1.138 | -0.00927 | 0.03496 | fixed |
| sibling_count4 | 0.01034 | 0.0116 | 0.8908 | -0.01241 | 0.03308 | fixed |
| sibling_count5 | 0.03911 | 0.01258 | 3.108 | 0.01444 | 0.06377 | fixed |
| sibling_count5+ | 0.03291 | 0.01219 | 2.699 | 0.00901 | 0.05681 | fixed |
| birth_order_nonlinear2 | -0.015 | 0.008375 | -1.791 | -0.03141 | 0.001419 | fixed |
| birth_order_nonlinear3 | -0.01467 | 0.009754 | -1.504 | -0.03379 | 0.004447 | fixed |
| birth_order_nonlinear4 | -0.007381 | 0.01154 | -0.6394 | -0.03001 | 0.01524 | fixed |
| birth_order_nonlinear5 | -0.01601 | 0.01406 | -1.138 | -0.04356 | 0.01155 | fixed |
| birth_order_nonlinear5+ | -0.02288 | 0.01282 | -1.785 | -0.04802 | 0.002247 | fixed |
| sd_(Intercept).mother_pidlink | 0.03209 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1824 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1241 | 0.1221 | 1.016 | -0.1153 | 0.3635 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.009842 | 0.01311 | -0.7506 | -0.03554 | 0.01586 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.000332 | 0.0004494 | 0.7389 | -0.0005487 | 0.001213 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000003868 | 0.000004927 | -0.785 | -0.00001353 | 0.000005789 | fixed |
| male | -0.01598 | 0.006177 | -2.587 | -0.02809 | -0.003875 | fixed |
| count_birth_order2/2 | 0.0135 | 0.01767 | 0.7641 | -0.02113 | 0.04813 | fixed |
| count_birth_order1/3 | 0.01416 | 0.0148 | 0.9565 | -0.01486 | 0.04317 | fixed |
| count_birth_order2/3 | 0.00501 | 0.01613 | 0.3106 | -0.0266 | 0.03662 | fixed |
| count_birth_order3/3 | 0.0268 | 0.01788 | 1.499 | -0.00825 | 0.06186 | fixed |
| count_birth_order1/4 | 0.04209 | 0.01607 | 2.62 | 0.0106 | 0.07358 | fixed |
| count_birth_order2/4 | 0.001262 | 0.01694 | 0.07454 | -0.03193 | 0.03445 | fixed |
| count_birth_order3/4 | -0.01579 | 0.01834 | -0.861 | -0.05173 | 0.02015 | fixed |
| count_birth_order4/4 | 0.001377 | 0.01992 | 0.06911 | -0.03767 | 0.04042 | fixed |
| count_birth_order1/5 | 0.01152 | 0.01943 | 0.5932 | -0.02655 | 0.0496 | fixed |
| count_birth_order2/5 | 0.04278 | 0.01992 | 2.147 | 0.003731 | 0.08183 | fixed |
| count_birth_order3/5 | 0.05774 | 0.02051 | 2.816 | 0.01755 | 0.09793 | fixed |
| count_birth_order4/5 | 0.05098 | 0.02088 | 2.441 | 0.01005 | 0.0919 | fixed |
| count_birth_order5/5 | 0.03361 | 0.0212 | 1.585 | -0.007949 | 0.07517 | fixed |
| count_birth_order1/5+ | 0.0718 | 0.01752 | 4.099 | 0.03746 | 0.1061 | fixed |
| count_birth_order2/5+ | 0.00797 | 0.01852 | 0.4303 | -0.02833 | 0.04427 | fixed |
| count_birth_order3/5+ | 0.01289 | 0.01785 | 0.7224 | -0.02209 | 0.04787 | fixed |
| count_birth_order4/5+ | 0.03653 | 0.01734 | 2.106 | 0.00254 | 0.07052 | fixed |
| count_birth_order5/5+ | 0.02583 | 0.01837 | 1.406 | -0.01018 | 0.06183 | fixed |
| count_birth_order5+/5+ | 0.01946 | 0.01378 | 1.412 | -0.007545 | 0.04646 | fixed |
| sd_(Intercept).mother_pidlink | 0.03092 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1822 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -1965 | -1897 | 993.5 | -1987 | NA | NA | NA |
| 12 | -1965 | -1890 | 994.3 | -1989 | 1.631 | 1 | 0.2015 |
| 16 | -1961 | -1861 | 996.3 | -1993 | 3.928 | 4 | 0.4158 |
| 26 | -1966 | -1805 | 1009 | -2018 | 25.91 | 10 | 0.003867 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1323 | 0.1239 | 1.068 | -0.1105 | 0.375 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.009582 | 0.01331 | -0.72 | -0.03566 | 0.0165 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0003121 | 0.0004563 | 0.684 | -0.0005822 | 0.001206 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000003541 | 0.000005007 | -0.7072 | -0.00001335 | 0.000006272 | fixed |
| male | -0.01515 | 0.006261 | -2.42 | -0.02742 | -0.002879 | fixed |
| sibling_count3 | 0.006555 | 0.009888 | 0.6629 | -0.01283 | 0.02593 | fixed |
| sibling_count4 | 0.0103 | 0.01033 | 0.9976 | -0.00994 | 0.03055 | fixed |
| sibling_count5 | 0.03153 | 0.01178 | 2.677 | 0.008448 | 0.05462 | fixed |
| sibling_count5+ | 0.02033 | 0.01 | 2.032 | 0.0007231 | 0.03993 | fixed |
| sd_(Intercept).mother_pidlink | 0.03537 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.182 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1282 | 0.1239 | 1.035 | -0.1145 | 0.371 | fixed |
| birth_order | -0.002884 | 0.001964 | -1.469 | -0.006734 | 0.0009649 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.008817 | 0.01331 | -0.6622 | -0.03491 | 0.01728 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0002926 | 0.0004564 | 0.6411 | -0.0006019 | 0.001187 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.00000345 | 0.000005006 | -0.6891 | -0.00001326 | 0.000006362 | fixed |
| male | -0.01511 | 0.00626 | -2.414 | -0.02738 | -0.00284 | fixed |
| sibling_count3 | 0.008016 | 0.009934 | 0.8069 | -0.01145 | 0.02749 | fixed |
| sibling_count4 | 0.01341 | 0.01054 | 1.272 | -0.007251 | 0.03406 | fixed |
| sibling_count5 | 0.03653 | 0.01225 | 2.98 | 0.01251 | 0.06054 | fixed |
| sibling_count5+ | 0.0306 | 0.0122 | 2.508 | 0.006687 | 0.05452 | fixed |
| sd_(Intercept).mother_pidlink | 0.03485 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1821 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.1321 | 0.124 | 1.066 | -0.1109 | 0.3752 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.009326 | 0.01332 | -0.7001 | -0.03543 | 0.01678 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0003124 | 0.0004566 | 0.6841 | -0.0005826 | 0.001207 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000003693 | 0.00000501 | -0.7371 | -0.00001351 | 0.000006127 | fixed |
| male | -0.01529 | 0.006263 | -2.441 | -0.02756 | -0.00301 | fixed |
| sibling_count3 | 0.008291 | 0.01015 | 0.8167 | -0.01161 | 0.02819 | fixed |
| sibling_count4 | 0.0134 | 0.01095 | 1.224 | -0.008063 | 0.03487 | fixed |
| sibling_count5 | 0.03807 | 0.01282 | 2.97 | 0.01295 | 0.06319 | fixed |
| sibling_count5+ | 0.03212 | 0.01257 | 2.556 | 0.007489 | 0.05675 | fixed |
| birth_order_nonlinear2 | -0.01056 | 0.008247 | -1.281 | -0.02672 | 0.005602 | fixed |
| birth_order_nonlinear3 | -0.007715 | 0.009724 | -0.7933 | -0.02677 | 0.01134 | fixed |
| birth_order_nonlinear4 | -0.009011 | 0.0122 | -0.7386 | -0.03292 | 0.0149 | fixed |
| birth_order_nonlinear5 | -0.02419 | 0.01504 | -1.609 | -0.05367 | 0.005283 | fixed |
| birth_order_nonlinear5+ | -0.0218 | 0.01465 | -1.488 | -0.05052 | 0.006923 | fixed |
| sd_(Intercept).mother_pidlink | 0.03468 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1822 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.121 | 0.1244 | 0.9726 | -0.1228 | 0.3649 | fixed |
| poly(age, 3, raw = TRUE)1 | -0.008724 | 0.01337 | -0.6525 | -0.03493 | 0.01748 | fixed |
| poly(age, 3, raw = TRUE)2 | 0.0002937 | 0.0004585 | 0.6407 | -0.0006049 | 0.001192 | fixed |
| poly(age, 3, raw = TRUE)3 | -0.000003527 | 0.000005032 | -0.7009 | -0.00001339 | 0.000006335 | fixed |
| male | -0.0155 | 0.006273 | -2.471 | -0.0278 | -0.003207 | fixed |
| count_birth_order2/2 | 0.005899 | 0.01572 | 0.3752 | -0.02492 | 0.03671 | fixed |
| count_birth_order1/3 | 0.01002 | 0.0132 | 0.7592 | -0.01585 | 0.03588 | fixed |
| count_birth_order2/3 | 0.004641 | 0.01468 | 0.3161 | -0.02413 | 0.03342 | fixed |
| count_birth_order3/3 | 0.01141 | 0.01582 | 0.721 | -0.0196 | 0.04241 | fixed |
| count_birth_order1/4 | 0.02893 | 0.01549 | 1.868 | -0.00143 | 0.05929 | fixed |
| count_birth_order2/4 | 0.01144 | 0.01628 | 0.7029 | -0.02046 | 0.04335 | fixed |
| count_birth_order3/4 | 0.002006 | 0.0169 | 0.1187 | -0.03111 | 0.03513 | fixed |
| count_birth_order4/4 | 0.0008381 | 0.01836 | 0.04565 | -0.03515 | 0.03682 | fixed |
| count_birth_order1/5 | 0.04949 | 0.02025 | 2.443 | 0.00979 | 0.08918 | fixed |
| count_birth_order2/5 | 0.02977 | 0.02263 | 1.316 | -0.01458 | 0.07413 | fixed |
| count_birth_order3/5 | 0.04936 | 0.02207 | 2.236 | 0.006101 | 0.09262 | fixed |
| count_birth_order4/5 | 0.02171 | 0.02125 | 1.022 | -0.01994 | 0.06335 | fixed |
| count_birth_order5/5 | 0.01596 | 0.02257 | 0.7072 | -0.02828 | 0.0602 | fixed |
| count_birth_order1/5+ | 0.04549 | 0.01974 | 2.305 | 0.006806 | 0.08417 | fixed |
| count_birth_order2/5+ | 0.001633 | 0.01997 | 0.08179 | -0.0375 | 0.04076 | fixed |
| count_birth_order3/5+ | 0.02498 | 0.01907 | 1.31 | -0.01239 | 0.06234 | fixed |
| count_birth_order4/5+ | 0.04811 | 0.01915 | 2.512 | 0.01057 | 0.08566 | fixed |
| count_birth_order5/5+ | 0.01544 | 0.01798 | 0.8588 | -0.0198 | 0.05069 | fixed |
| count_birth_order5+/5+ | 0.01582 | 0.0139 | 1.138 | -0.01143 | 0.04307 | fixed |
| sd_(Intercept).mother_pidlink | 0.03447 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.1823 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | -1911 | -1843 | 966.6 | -1933 | NA | NA | NA |
| 12 | -1911 | -1837 | 967.7 | -1935 | 2.166 | 1 | 0.1411 |
| 16 | -1905 | -1806 | 968.7 | -1937 | 1.891 | 4 | 0.7558 |
| 26 | -1893 | -1732 | 972.6 | -1945 | 7.916 | 10 | 0.637 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = ever_smoked)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.03 | 0.0503 | -20.47 | -1.128 | -0.9312 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08253 | 0.004782 | 17.26 | 0.07316 | 0.0919 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.001978 | 0.0001393 | -14.2 | -0.002251 | -0.001705 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00001503 | 0.000001267 | 11.86 | 0.00001255 | 0.00001751 | fixed |
| male | 0.6583 | 0.005408 | 121.7 | 0.6477 | 0.6689 | fixed |
| sibling_count3 | -0.01002 | 0.01094 | -0.9159 | -0.03148 | 0.01143 | fixed |
| sibling_count4 | -0.001492 | 0.01126 | -0.1325 | -0.02357 | 0.02058 | fixed |
| sibling_count5 | 0.01039 | 0.01177 | 0.8824 | -0.01268 | 0.03345 | fixed |
| sibling_count5+ | 0.01886 | 0.009216 | 2.047 | 0.0008013 | 0.03693 | fixed |
| sd_(Intercept).mother_pidlink | 0.1122 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.311 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.03 | 0.0503 | -20.48 | -1.129 | -0.9315 | fixed |
| birth_order | -0.0009195 | 0.001144 | -0.8039 | -0.003161 | 0.001322 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0828 | 0.004794 | 17.27 | 0.0734 | 0.09219 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.001988 | 0.0001398 | -14.22 | -0.002262 | -0.001714 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00001512 | 0.000001272 | 11.88 | 0.00001263 | 0.00001761 | fixed |
| male | 0.6583 | 0.005408 | 121.7 | 0.6477 | 0.6689 | fixed |
| sibling_count3 | -0.009801 | 0.01095 | -0.8952 | -0.03126 | 0.01166 | fixed |
| sibling_count4 | -0.0008537 | 0.01129 | -0.07562 | -0.02298 | 0.02127 | fixed |
| sibling_count5 | 0.01149 | 0.01185 | 0.9696 | -0.01173 | 0.03471 | fixed |
| sibling_count5+ | 0.02234 | 0.01018 | 2.195 | 0.002388 | 0.04229 | fixed |
| sd_(Intercept).mother_pidlink | 0.1122 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.311 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.035 | 0.05044 | -20.52 | -1.134 | -0.9364 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08307 | 0.004796 | 17.32 | 0.07367 | 0.09247 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.001998 | 0.0001399 | -14.29 | -0.002272 | -0.001724 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00001522 | 0.000001273 | 11.96 | 0.00001273 | 0.00001772 | fixed |
| male | 0.6584 | 0.005408 | 121.7 | 0.6478 | 0.669 | fixed |
| sibling_count3 | -0.008598 | 0.0111 | -0.7743 | -0.03036 | 0.01317 | fixed |
| sibling_count4 | -0.000003608 | 0.01161 | -0.0003108 | -0.02276 | 0.02275 | fixed |
| sibling_count5 | 0.01432 | 0.0123 | 1.164 | -0.009785 | 0.03844 | fixed |
| sibling_count5+ | 0.02736 | 0.01069 | 2.558 | 0.006396 | 0.04832 | fixed |
| birth_order_nonlinear2 | 0.006211 | 0.007852 | 0.791 | -0.009178 | 0.0216 | fixed |
| birth_order_nonlinear3 | -0.005846 | 0.009241 | -0.6326 | -0.02396 | 0.01227 | fixed |
| birth_order_nonlinear4 | 0.0003569 | 0.01056 | 0.0338 | -0.02034 | 0.02105 | fixed |
| birth_order_nonlinear5 | -0.01352 | 0.01202 | -1.125 | -0.03708 | 0.01004 | fixed |
| birth_order_nonlinear5+ | -0.01148 | 0.009959 | -1.153 | -0.031 | 0.008039 | fixed |
| sd_(Intercept).mother_pidlink | 0.1122 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.311 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.041 | 0.05065 | -20.55 | -1.14 | -0.9414 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08302 | 0.004795 | 17.31 | 0.07362 | 0.09242 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002001 | 0.0001399 | -14.31 | -0.002275 | -0.001727 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00001528 | 0.000001273 | 12.01 | 0.00001279 | 0.00001778 | fixed |
| male | 0.6581 | 0.005408 | 121.7 | 0.6475 | 0.6687 | fixed |
| count_birth_order2/2 | 0.02629 | 0.01527 | 1.722 | -0.003631 | 0.05621 | fixed |
| count_birth_order1/3 | -0.01405 | 0.0145 | -0.9691 | -0.04248 | 0.01437 | fixed |
| count_birth_order2/3 | 0.01445 | 0.01621 | 0.8916 | -0.01732 | 0.04623 | fixed |
| count_birth_order3/3 | 0.00651 | 0.01806 | 0.3604 | -0.0289 | 0.04192 | fixed |
| count_birth_order1/4 | 0.01338 | 0.01641 | 0.8149 | -0.01879 | 0.04555 | fixed |
| count_birth_order2/4 | 0.006355 | 0.01745 | 0.3641 | -0.02785 | 0.04056 | fixed |
| count_birth_order3/4 | -0.001847 | 0.01893 | -0.09757 | -0.03895 | 0.03526 | fixed |
| count_birth_order4/4 | 0.01231 | 0.01984 | 0.6205 | -0.02658 | 0.0512 | fixed |
| count_birth_order1/5 | 0.03854 | 0.01879 | 2.051 | 0.001707 | 0.07537 | fixed |
| count_birth_order2/5 | 0.005322 | 0.01985 | 0.2681 | -0.03359 | 0.04423 | fixed |
| count_birth_order3/5 | 0.003385 | 0.02026 | 0.167 | -0.03633 | 0.0431 | fixed |
| count_birth_order4/5 | 0.05807 | 0.0217 | 2.676 | 0.01554 | 0.1006 | fixed |
| count_birth_order5/5 | -0.008625 | 0.02211 | -0.3901 | -0.05196 | 0.03471 | fixed |
| count_birth_order1/5+ | 0.04767 | 0.01512 | 3.152 | 0.01803 | 0.0773 | fixed |
| count_birth_order2/5+ | 0.03767 | 0.01564 | 2.409 | 0.007016 | 0.06833 | fixed |
| count_birth_order3/5+ | 0.02911 | 0.01529 | 1.903 | -0.0008641 | 0.05908 | fixed |
| count_birth_order4/5+ | 0.0213 | 0.01504 | 1.417 | -0.008173 | 0.05078 | fixed |
| count_birth_order5/5+ | 0.02724 | 0.01511 | 1.802 | -0.00238 | 0.05687 | fixed |
| count_birth_order5+/5+ | 0.02345 | 0.01185 | 1.979 | 0.0002202 | 0.04667 | fixed |
| sd_(Intercept).mother_pidlink | 0.1121 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.311 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 9037 | 9120 | -4507 | 9015 | NA | NA | NA |
| 12 | 9038 | 9129 | -4507 | 9014 | 0.6469 | 1 | 0.4212 |
| 16 | 9042 | 9164 | -4505 | 9010 | 3.709 | 4 | 0.4468 |
| 26 | 9046 | 9244 | -4497 | 8994 | 16.27 | 10 | 0.09213 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.811 | 0.1473 | -12.3 | -2.1 | -1.523 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.175 | 0.01672 | 10.47 | 0.1423 | 0.2078 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005302 | 0.0005975 | -8.873 | -0.006473 | -0.004131 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005222 | 0.000006778 | 7.704 | 0.00003893 | 0.0000655 | fixed |
| male | 0.5873 | 0.008561 | 68.6 | 0.5705 | 0.6041 | fixed |
| sibling_count3 | 0.007451 | 0.0136 | 0.5479 | -0.0192 | 0.03411 | fixed |
| sibling_count4 | 0.004702 | 0.01467 | 0.3206 | -0.02405 | 0.03345 | fixed |
| sibling_count5 | 0.03346 | 0.01688 | 1.982 | 0.0003739 | 0.06655 | fixed |
| sibling_count5+ | 0.0422 | 0.01476 | 2.859 | 0.01327 | 0.07113 | fixed |
| sd_(Intercept).mother_pidlink | 0.135 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3135 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.811 | 0.1473 | -12.29 | -2.1 | -1.522 | fixed |
| birth_order | -0.0006785 | 0.002855 | -0.2377 | -0.006274 | 0.004917 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1751 | 0.01672 | 10.47 | 0.1423 | 0.2078 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005302 | 0.0005976 | -8.872 | -0.006473 | -0.004131 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005219 | 0.000006779 | 7.698 | 0.0000389 | 0.00006548 | fixed |
| male | 0.5873 | 0.008562 | 68.59 | 0.5705 | 0.6041 | fixed |
| sibling_count3 | 0.007791 | 0.01368 | 0.5697 | -0.01901 | 0.0346 | fixed |
| sibling_count4 | 0.005488 | 0.01504 | 0.365 | -0.02398 | 0.03496 | fixed |
| sibling_count5 | 0.03474 | 0.01772 | 1.96 | 0.000007231 | 0.06947 | fixed |
| sibling_count5+ | 0.04478 | 0.01832 | 2.445 | 0.008878 | 0.08068 | fixed |
| sd_(Intercept).mother_pidlink | 0.135 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3135 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.823 | 0.1476 | -12.35 | -2.113 | -1.534 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1759 | 0.01674 | 10.5 | 0.1431 | 0.2087 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005327 | 0.0005982 | -8.905 | -0.0065 | -0.004155 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005238 | 0.000006787 | 7.718 | 0.00003908 | 0.00006568 | fixed |
| male | 0.5875 | 0.008564 | 68.6 | 0.5707 | 0.6043 | fixed |
| sibling_count3 | 0.006373 | 0.01395 | 0.4567 | -0.02098 | 0.03372 | fixed |
| sibling_count4 | 0.005122 | 0.01561 | 0.3282 | -0.02547 | 0.03571 | fixed |
| sibling_count5 | 0.03905 | 0.01858 | 2.102 | 0.002639 | 0.07546 | fixed |
| sibling_count5+ | 0.05275 | 0.01885 | 2.798 | 0.01579 | 0.0897 | fixed |
| birth_order_nonlinear2 | 0.01327 | 0.01101 | 1.205 | -0.008314 | 0.03486 | fixed |
| birth_order_nonlinear3 | 0.005947 | 0.01359 | 0.4377 | -0.02069 | 0.03258 | fixed |
| birth_order_nonlinear4 | -0.002039 | 0.01687 | -0.1209 | -0.0351 | 0.03103 | fixed |
| birth_order_nonlinear5 | -0.0184 | 0.02114 | -0.8704 | -0.05983 | 0.02303 | fixed |
| birth_order_nonlinear5+ | -0.01167 | 0.02127 | -0.5488 | -0.05335 | 0.03001 | fixed |
| sd_(Intercept).mother_pidlink | 0.1349 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3136 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.824 | 0.1479 | -12.33 | -2.114 | -1.534 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.175 | 0.01678 | 10.43 | 0.1421 | 0.2079 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005298 | 0.0005996 | -8.836 | -0.006473 | -0.004123 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005206 | 0.000006804 | 7.651 | 0.00003872 | 0.0000654 | fixed |
| male | 0.5874 | 0.008572 | 68.52 | 0.5706 | 0.6042 | fixed |
| count_birth_order2/2 | 0.03734 | 0.01984 | 1.882 | -0.001552 | 0.07623 | fixed |
| count_birth_order1/3 | 0.02279 | 0.01783 | 1.278 | -0.01215 | 0.05772 | fixed |
| count_birth_order2/3 | 0.01879 | 0.01937 | 0.9702 | -0.01917 | 0.05676 | fixed |
| count_birth_order3/3 | 0.01655 | 0.02162 | 0.7655 | -0.02582 | 0.05892 | fixed |
| count_birth_order1/4 | 0.006185 | 0.0217 | 0.285 | -0.03634 | 0.04871 | fixed |
| count_birth_order2/4 | 0.0236 | 0.02242 | 1.053 | -0.02033 | 0.06754 | fixed |
| count_birth_order3/4 | 0.03506 | 0.02373 | 1.477 | -0.01146 | 0.08157 | fixed |
| count_birth_order4/4 | 0.007861 | 0.02467 | 0.3187 | -0.04048 | 0.0562 | fixed |
| count_birth_order1/5 | 0.03545 | 0.0295 | 1.202 | -0.02237 | 0.09326 | fixed |
| count_birth_order2/5 | 0.06082 | 0.0317 | 1.918 | -0.00132 | 0.123 | fixed |
| count_birth_order3/5 | 0.05973 | 0.02949 | 2.026 | 0.001939 | 0.1175 | fixed |
| count_birth_order4/5 | 0.04242 | 0.02892 | 1.467 | -0.01426 | 0.09909 | fixed |
| count_birth_order5/5 | 0.03742 | 0.02999 | 1.248 | -0.02136 | 0.0962 | fixed |
| count_birth_order1/5+ | 0.09227 | 0.0293 | 3.149 | 0.03485 | 0.1497 | fixed |
| count_birth_order2/5+ | 0.06653 | 0.02937 | 2.265 | 0.008968 | 0.1241 | fixed |
| count_birth_order3/5+ | 0.04338 | 0.02873 | 1.51 | -0.01293 | 0.09969 | fixed |
| count_birth_order4/5+ | 0.06546 | 0.02705 | 2.42 | 0.01245 | 0.1185 | fixed |
| count_birth_order5/5+ | 0.03659 | 0.02583 | 1.417 | -0.01403 | 0.08721 | fixed |
| count_birth_order5+/5+ | 0.04926 | 0.01961 | 2.512 | 0.01083 | 0.0877 | fixed |
| sd_(Intercept).mother_pidlink | 0.1344 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3139 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 4222 | 4296 | -2100 | 4200 | NA | NA | NA |
| 12 | 4224 | 4304 | -2100 | 4200 | 0.05593 | 1 | 0.813 |
| 16 | 4228 | 4336 | -2098 | 4196 | 3.26 | 4 | 0.5153 |
| 26 | 4242 | 4417 | -2095 | 4190 | 6.288 | 10 | 0.7905 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.794 | 0.1469 | -12.21 | -2.081 | -1.506 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1732 | 0.01669 | 10.38 | 0.1405 | 0.2059 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005237 | 0.0005964 | -8.78 | -0.006406 | -0.004068 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005152 | 0.000006767 | 7.614 | 0.00003826 | 0.00006479 | fixed |
| male | 0.5869 | 0.008534 | 68.77 | 0.5702 | 0.6036 | fixed |
| sibling_count3 | 0.008936 | 0.01474 | 0.6065 | -0.01994 | 0.03782 | fixed |
| sibling_count4 | -0.001759 | 0.01552 | -0.1134 | -0.03218 | 0.02866 | fixed |
| sibling_count5 | 0.02235 | 0.0167 | 1.338 | -0.01038 | 0.05507 | fixed |
| sibling_count5+ | 0.0372 | 0.01461 | 2.547 | 0.008571 | 0.06583 | fixed |
| sd_(Intercept).mother_pidlink | 0.1351 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3138 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.794 | 0.1469 | -12.21 | -2.082 | -1.506 | fixed |
| birth_order | 0.00006028 | 0.002496 | 0.02415 | -0.004833 | 0.004953 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1732 | 0.01669 | 10.38 | 0.1405 | 0.2059 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005237 | 0.0005965 | -8.779 | -0.006406 | -0.004068 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005153 | 0.000006769 | 7.612 | 0.00003826 | 0.00006479 | fixed |
| male | 0.5869 | 0.008535 | 68.77 | 0.5702 | 0.6036 | fixed |
| sibling_count3 | 0.008906 | 0.01479 | 0.6023 | -0.02008 | 0.03789 | fixed |
| sibling_count4 | -0.001826 | 0.01577 | -0.1158 | -0.03273 | 0.02907 | fixed |
| sibling_count5 | 0.02224 | 0.01726 | 1.289 | -0.01158 | 0.05606 | fixed |
| sibling_count5+ | 0.03698 | 0.01725 | 2.144 | 0.003169 | 0.07079 | fixed |
| sd_(Intercept).mother_pidlink | 0.1351 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3138 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.805 | 0.1472 | -12.26 | -2.094 | -1.517 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1739 | 0.0167 | 10.41 | 0.1412 | 0.2067 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005261 | 0.000597 | -8.812 | -0.006431 | -0.004091 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005171 | 0.000006775 | 7.631 | 0.00003843 | 0.00006499 | fixed |
| male | 0.5871 | 0.008536 | 68.78 | 0.5704 | 0.6038 | fixed |
| sibling_count3 | 0.009283 | 0.01506 | 0.6165 | -0.02023 | 0.0388 | fixed |
| sibling_count4 | -0.001904 | 0.01631 | -0.1168 | -0.03386 | 0.03005 | fixed |
| sibling_count5 | 0.02286 | 0.01805 | 1.267 | -0.01251 | 0.05823 | fixed |
| sibling_count5+ | 0.04524 | 0.01778 | 2.545 | 0.0104 | 0.08008 | fixed |
| birth_order_nonlinear2 | 0.01394 | 0.01123 | 1.241 | -0.008069 | 0.03595 | fixed |
| birth_order_nonlinear3 | -0.0001939 | 0.01354 | -0.01432 | -0.02674 | 0.02635 | fixed |
| birth_order_nonlinear4 | 0.006623 | 0.01636 | 0.4047 | -0.02545 | 0.0387 | fixed |
| birth_order_nonlinear5 | 0.004426 | 0.02007 | 0.2205 | -0.03492 | 0.04377 | fixed |
| birth_order_nonlinear5+ | -0.01611 | 0.01903 | -0.8463 | -0.05342 | 0.0212 | fixed |
| sd_(Intercept).mother_pidlink | 0.1356 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3136 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.817 | 0.1475 | -12.31 | -2.106 | -1.528 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1742 | 0.01673 | 10.41 | 0.1414 | 0.207 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005268 | 0.0005982 | -8.807 | -0.00644 | -0.004096 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005175 | 0.000006789 | 7.623 | 0.00003845 | 0.00006506 | fixed |
| male | 0.5867 | 0.008543 | 68.68 | 0.57 | 0.6035 | fixed |
| count_birth_order2/2 | 0.04181 | 0.0218 | 1.918 | -0.0009097 | 0.08454 | fixed |
| count_birth_order1/3 | 0.0185 | 0.01933 | 0.9574 | -0.01937 | 0.05638 | fixed |
| count_birth_order2/3 | 0.0225 | 0.02097 | 1.073 | -0.01859 | 0.0636 | fixed |
| count_birth_order3/3 | 0.03344 | 0.02342 | 1.428 | -0.01246 | 0.07935 | fixed |
| count_birth_order1/4 | 0.0112 | 0.0227 | 0.4936 | -0.03328 | 0.05569 | fixed |
| count_birth_order2/4 | 0.03426 | 0.02315 | 1.48 | -0.0111 | 0.07963 | fixed |
| count_birth_order3/4 | -0.0004727 | 0.02537 | -0.01863 | -0.05019 | 0.04925 | fixed |
| count_birth_order4/4 | -0.00158 | 0.02624 | -0.06022 | -0.05301 | 0.04985 | fixed |
| count_birth_order1/5 | 0.05073 | 0.02702 | 1.877 | -0.00223 | 0.1037 | fixed |
| count_birth_order2/5 | 0.03313 | 0.02898 | 1.143 | -0.02368 | 0.08994 | fixed |
| count_birth_order3/5 | 0.0241 | 0.02834 | 0.8502 | -0.03145 | 0.07964 | fixed |
| count_birth_order4/5 | 0.03857 | 0.02958 | 1.304 | -0.01941 | 0.09654 | fixed |
| count_birth_order5/5 | 0.03566 | 0.02946 | 1.211 | -0.02207 | 0.09339 | fixed |
| count_birth_order1/5+ | 0.06043 | 0.02573 | 2.348 | 0.009995 | 0.1109 | fixed |
| count_birth_order2/5+ | 0.05178 | 0.02694 | 1.922 | -0.001035 | 0.1046 | fixed |
| count_birth_order3/5+ | 0.04945 | 0.02611 | 1.894 | -0.001733 | 0.1006 | fixed |
| count_birth_order4/5+ | 0.07459 | 0.02516 | 2.965 | 0.02528 | 0.1239 | fixed |
| count_birth_order5/5+ | 0.05976 | 0.02593 | 2.305 | 0.00894 | 0.1106 | fixed |
| count_birth_order5+/5+ | 0.03856 | 0.01928 | 2.001 | 0.0007835 | 0.07634 | fixed |
| sd_(Intercept).mother_pidlink | 0.1352 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3139 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 4271 | 4345 | -2124 | 4249 | NA | NA | NA |
| 12 | 4273 | 4354 | -2124 | 4249 | 0.0006262 | 1 | 0.98 |
| 16 | 4277 | 4385 | -2123 | 4245 | 3.427 | 4 | 0.489 |
| 26 | 4291 | 4467 | -2120 | 4239 | 6.031 | 10 | 0.8126 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.855 | 0.1489 | -12.46 | -2.147 | -1.564 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1807 | 0.01692 | 10.68 | 0.1475 | 0.2139 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005507 | 0.0006047 | -9.107 | -0.006692 | -0.004322 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000546 | 0.000006863 | 7.955 | 0.00004115 | 0.00006805 | fixed |
| male | 0.5873 | 0.008645 | 67.94 | 0.5704 | 0.6042 | fixed |
| sibling_count3 | 0.002991 | 0.01342 | 0.2229 | -0.02331 | 0.02929 | fixed |
| sibling_count4 | -0.001225 | 0.01458 | -0.08399 | -0.0298 | 0.02735 | fixed |
| sibling_count5 | 0.01576 | 0.01729 | 0.9113 | -0.01813 | 0.04964 | fixed |
| sibling_count5+ | 0.03472 | 0.01492 | 2.327 | 0.00548 | 0.06395 | fixed |
| sd_(Intercept).mother_pidlink | 0.1349 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3134 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.855 | 0.1489 | -12.46 | -2.147 | -1.563 | fixed |
| birth_order | -0.000005795 | 0.002939 | -0.001972 | -0.005766 | 0.005754 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1807 | 0.01692 | 10.68 | 0.1475 | 0.2139 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005507 | 0.0006048 | -9.106 | -0.006692 | -0.004322 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.0000546 | 0.000006865 | 7.954 | 0.00004114 | 0.00006805 | fixed |
| male | 0.5873 | 0.008646 | 67.93 | 0.5704 | 0.6042 | fixed |
| sibling_count3 | 0.002994 | 0.0135 | 0.2218 | -0.02347 | 0.02946 | fixed |
| sibling_count4 | -0.001218 | 0.01496 | -0.08141 | -0.03054 | 0.0281 | fixed |
| sibling_count5 | 0.01577 | 0.01809 | 0.8717 | -0.01968 | 0.05122 | fixed |
| sibling_count5+ | 0.03474 | 0.01857 | 1.871 | -0.00165 | 0.07113 | fixed |
| sd_(Intercept).mother_pidlink | 0.1349 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3134 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.869 | 0.1492 | -12.53 | -2.162 | -1.577 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1817 | 0.01694 | 10.73 | 0.1485 | 0.2149 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005537 | 0.0006053 | -9.147 | -0.006723 | -0.004351 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005483 | 0.000006871 | 7.979 | 0.00004136 | 0.00006829 | fixed |
| male | 0.5875 | 0.008647 | 67.94 | 0.5705 | 0.6044 | fixed |
| sibling_count3 | 0.001975 | 0.01379 | 0.1433 | -0.02505 | 0.029 | fixed |
| sibling_count4 | -0.0008761 | 0.01555 | -0.05635 | -0.03135 | 0.0296 | fixed |
| sibling_count5 | 0.02003 | 0.01889 | 1.06 | -0.017 | 0.05706 | fixed |
| sibling_count5+ | 0.04395 | 0.01914 | 2.296 | 0.006439 | 0.08146 | fixed |
| birth_order_nonlinear2 | 0.01494 | 0.01099 | 1.36 | -0.006592 | 0.03647 | fixed |
| birth_order_nonlinear3 | 0.006761 | 0.01359 | 0.4976 | -0.01987 | 0.03339 | fixed |
| birth_order_nonlinear4 | -0.002179 | 0.01735 | -0.1256 | -0.03619 | 0.03183 | fixed |
| birth_order_nonlinear5 | -0.01151 | 0.022 | -0.5233 | -0.05462 | 0.0316 | fixed |
| birth_order_nonlinear5+ | -0.01037 | 0.02192 | -0.4732 | -0.05333 | 0.03259 | fixed |
| sd_(Intercept).mother_pidlink | 0.135 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3134 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -1.866 | 0.1496 | -12.47 | -2.159 | -1.573 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.1803 | 0.01697 | 10.62 | 0.147 | 0.2136 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.005484 | 0.0006068 | -9.037 | -0.006673 | -0.004294 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00005418 | 0.00000689 | 7.864 | 0.00004068 | 0.00006769 | fixed |
| male | 0.5871 | 0.008655 | 67.84 | 0.5702 | 0.6041 | fixed |
| count_birth_order2/2 | 0.03855 | 0.01928 | 2 | 0.0007658 | 0.07634 | fixed |
| count_birth_order1/3 | 0.01712 | 0.0176 | 0.973 | -0.01737 | 0.05162 | fixed |
| count_birth_order2/3 | 0.01647 | 0.01936 | 0.8508 | -0.02147 | 0.05442 | fixed |
| count_birth_order3/3 | 0.01444 | 0.02124 | 0.6799 | -0.02719 | 0.05608 | fixed |
| count_birth_order1/4 | -0.006943 | 0.02179 | -0.3187 | -0.04964 | 0.03576 | fixed |
| count_birth_order2/4 | 0.02816 | 0.02244 | 1.255 | -0.01583 | 0.07215 | fixed |
| count_birth_order3/4 | 0.02373 | 0.02352 | 1.009 | -0.02236 | 0.06982 | fixed |
| count_birth_order4/4 | 0.006673 | 0.02483 | 0.2687 | -0.042 | 0.05534 | fixed |
| count_birth_order1/5 | 0.03185 | 0.0295 | 1.08 | -0.02596 | 0.08967 | fixed |
| count_birth_order2/5 | 0.02865 | 0.03271 | 0.876 | -0.03545 | 0.09276 | fixed |
| count_birth_order3/5 | 0.03949 | 0.03081 | 1.282 | -0.02089 | 0.09986 | fixed |
| count_birth_order4/5 | 0.01282 | 0.03022 | 0.4241 | -0.04641 | 0.07204 | fixed |
| count_birth_order5/5 | 0.03525 | 0.03195 | 1.103 | -0.02737 | 0.09787 | fixed |
| count_birth_order1/5+ | 0.09172 | 0.03002 | 3.055 | 0.03288 | 0.1506 | fixed |
| count_birth_order2/5+ | 0.04846 | 0.0301 | 1.61 | -0.01054 | 0.1075 | fixed |
| count_birth_order3/5+ | 0.04365 | 0.02902 | 1.504 | -0.01323 | 0.1005 | fixed |
| count_birth_order4/5+ | 0.05895 | 0.02846 | 2.071 | 0.003172 | 0.1147 | fixed |
| count_birth_order5/5+ | 0.02874 | 0.0264 | 1.089 | -0.023 | 0.08049 | fixed |
| count_birth_order5+/5+ | 0.04156 | 0.01996 | 2.082 | 0.002429 | 0.08069 | fixed |
| sd_(Intercept).mother_pidlink | 0.1344 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.3137 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 4133 | 4207 | -2056 | 4111 | NA | NA | NA |
| 12 | 4135 | 4216 | -2056 | 4111 | 0.0000002846 | 1 | 0.9996 |
| 16 | 4140 | 4248 | -2054 | 4108 | 3.094 | 4 | 0.5423 |
| 26 | 4153 | 4327 | -2050 | 4101 | 7.745 | 10 | 0.6537 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)

birthorder <- birthorder %>% mutate(outcome = still_smoking)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.4994 | 0.07927 | 6.299 | 0.344 | 0.6547 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02068 | 0.006708 | 3.082 | 0.00753 | 0.03383 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0005941 | 0.0001832 | -3.243 | -0.0009531 | -0.0002351 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000004817 | 0.000001566 | 3.076 | 0.000001748 | 0.000007886 | fixed |
| male | 0.2089 | 0.02436 | 8.575 | 0.1611 | 0.2566 | fixed |
| sibling_count3 | 0.01578 | 0.01612 | 0.9789 | -0.01581 | 0.04737 | fixed |
| sibling_count4 | 0.003225 | 0.01616 | 0.1996 | -0.02844 | 0.03489 | fixed |
| sibling_count5 | 0.009782 | 0.01671 | 0.5853 | -0.02297 | 0.04253 | fixed |
| sibling_count5+ | 0.0114 | 0.01314 | 0.8676 | -0.01435 | 0.03715 | fixed |
| sd_(Intercept).mother_pidlink | 0.03882 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2719 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.4993 | 0.07928 | 6.297 | 0.3439 | 0.6547 | fixed |
| birth_order | -0.0001987 | 0.001539 | -0.1291 | -0.003215 | 0.002818 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02074 | 0.006724 | 3.084 | 0.007557 | 0.03391 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.000596 | 0.0001838 | -3.243 | -0.0009562 | -0.0002358 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000004833 | 0.000001571 | 3.076 | 0.000001754 | 0.000007912 | fixed |
| male | 0.2089 | 0.02436 | 8.575 | 0.1612 | 0.2566 | fixed |
| sibling_count3 | 0.01584 | 0.01613 | 0.9821 | -0.01577 | 0.04745 | fixed |
| sibling_count4 | 0.003347 | 0.01619 | 0.2068 | -0.02838 | 0.03507 | fixed |
| sibling_count5 | 0.009997 | 0.0168 | 0.5952 | -0.02292 | 0.04292 | fixed |
| sibling_count5+ | 0.01211 | 0.01424 | 0.85 | -0.01581 | 0.04002 | fixed |
| sd_(Intercept).mother_pidlink | 0.03895 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2719 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.4961 | 0.07939 | 6.249 | 0.3405 | 0.6517 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02088 | 0.006727 | 3.104 | 0.007696 | 0.03406 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0005984 | 0.0001838 | -3.256 | -0.0009587 | -0.0002382 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000004839 | 0.000001571 | 3.081 | 0.000001761 | 0.000007918 | fixed |
| male | 0.2098 | 0.02437 | 8.608 | 0.162 | 0.2575 | fixed |
| sibling_count3 | 0.02091 | 0.01643 | 1.272 | -0.0113 | 0.05311 | fixed |
| sibling_count4 | 0.005396 | 0.01667 | 0.3237 | -0.02728 | 0.03807 | fixed |
| sibling_count5 | 0.01371 | 0.01745 | 0.7858 | -0.02049 | 0.04792 | fixed |
| sibling_count5+ | 0.01531 | 0.01499 | 1.021 | -0.01407 | 0.0447 | fixed |
| birth_order_nonlinear2 | 0.00008096 | 0.01166 | 0.006942 | -0.02278 | 0.02294 | fixed |
| birth_order_nonlinear3 | -0.01968 | 0.01347 | -1.462 | -0.04608 | 0.006712 | fixed |
| birth_order_nonlinear4 | 0.009552 | 0.01505 | 0.6349 | -0.01994 | 0.03904 | fixed |
| birth_order_nonlinear5 | -0.01544 | 0.01716 | -0.8998 | -0.04908 | 0.01819 | fixed |
| birth_order_nonlinear5+ | -0.002691 | 0.01378 | -0.1952 | -0.02971 | 0.02432 | fixed |
| sd_(Intercept).mother_pidlink | 0.03821 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.272 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | 0.493 | 0.07968 | 6.187 | 0.3368 | 0.6491 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.02063 | 0.006731 | 3.065 | 0.007438 | 0.03382 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.0005914 | 0.0001838 | -3.217 | -0.0009517 | -0.0002311 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000004788 | 0.00000157 | 3.049 | 0.00000171 | 0.000007866 | fixed |
| male | 0.2092 | 0.02437 | 8.584 | 0.1614 | 0.2569 | fixed |
| count_birth_order2/2 | 0.01447 | 0.02335 | 0.6196 | -0.0313 | 0.06024 | fixed |
| count_birth_order1/3 | 0.02399 | 0.02313 | 1.037 | -0.02135 | 0.06933 | fixed |
| count_birth_order2/3 | 0.03065 | 0.0246 | 1.246 | -0.01756 | 0.07886 | fixed |
| count_birth_order3/3 | 0.007198 | 0.02658 | 0.2708 | -0.04489 | 0.05929 | fixed |
| count_birth_order1/4 | 0.0006132 | 0.0246 | 0.02493 | -0.04759 | 0.04882 | fixed |
| count_birth_order2/4 | 0.008111 | 0.02642 | 0.307 | -0.04368 | 0.0599 | fixed |
| count_birth_order3/4 | -0.001621 | 0.02848 | -0.05692 | -0.05744 | 0.0542 | fixed |
| count_birth_order4/4 | 0.03651 | 0.02921 | 1.25 | -0.02074 | 0.09375 | fixed |
| count_birth_order1/5 | 0.04653 | 0.0274 | 1.698 | -0.007168 | 0.1002 | fixed |
| count_birth_order2/5 | -0.02254 | 0.03016 | -0.7475 | -0.08165 | 0.03656 | fixed |
| count_birth_order3/5 | -0.04164 | 0.03144 | -1.324 | -0.1033 | 0.01998 | fixed |
| count_birth_order4/5 | 0.02983 | 0.03076 | 0.9699 | -0.03045 | 0.09012 | fixed |
| count_birth_order5/5 | 0.06484 | 0.03397 | 1.908 | -0.001749 | 0.1314 | fixed |
| count_birth_order1/5+ | 0.02421 | 0.02135 | 1.134 | -0.01763 | 0.06605 | fixed |
| count_birth_order2/5+ | 0.03074 | 0.02247 | 1.368 | -0.0133 | 0.07477 | fixed |
| count_birth_order3/5+ | 0.01257 | 0.02201 | 0.5714 | -0.03056 | 0.0557 | fixed |
| count_birth_order4/5+ | 0.02479 | 0.02202 | 1.126 | -0.01837 | 0.06795 | fixed |
| count_birth_order5/5+ | -0.01014 | 0.02209 | -0.4591 | -0.05344 | 0.03316 | fixed |
| count_birth_order5+/5+ | 0.01887 | 0.01779 | 1.06 | -0.016 | 0.05374 | fixed |
| sd_(Intercept).mother_pidlink | 0.03823 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2719 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 1276 | 1348 | -627.1 | 1254 | NA | NA | NA |
| 12 | 1278 | 1356 | -627.1 | 1254 | 0.01671 | 1 | 0.8972 |
| 16 | 1282 | 1386 | -624.8 | 1250 | 4.631 | 4 | 0.3273 |
| 26 | 1288 | 1457 | -617.9 | 1236 | 13.77 | 10 | 0.1836 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.08365 | 0.2385 | -0.3507 | -0.5511 | 0.3838 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08334 | 0.02526 | 3.299 | 0.03383 | 0.1328 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002847 | 0.0008678 | -3.281 | -0.004548 | -0.001146 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003 | 0.000009506 | 3.156 | 0.00001136 | 0.00004863 | fixed |
| male | 0.2353 | 0.04151 | 5.669 | 0.154 | 0.3167 | fixed |
| sibling_count3 | 0.008865 | 0.02092 | 0.4238 | -0.03213 | 0.04986 | fixed |
| sibling_count4 | 0.03489 | 0.02196 | 1.589 | -0.008154 | 0.07793 | fixed |
| sibling_count5 | 0.02659 | 0.02399 | 1.108 | -0.02043 | 0.0736 | fixed |
| sibling_count5+ | 0.03027 | 0.02075 | 1.459 | -0.01041 | 0.07094 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2791 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.08354 | 0.2386 | -0.3502 | -0.5511 | 0.384 | fixed |
| birth_order | -0.001376 | 0.003918 | -0.3513 | -0.009056 | 0.006303 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08351 | 0.02527 | 3.305 | 0.03398 | 0.133 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.00285 | 0.0008681 | -3.283 | -0.004551 | -0.001149 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002997 | 0.000009508 | 3.152 | 0.00001133 | 0.00004861 | fixed |
| male | 0.2352 | 0.04153 | 5.664 | 0.1538 | 0.3166 | fixed |
| sibling_count3 | 0.009502 | 0.021 | 0.4525 | -0.03166 | 0.05066 | fixed |
| sibling_count4 | 0.03644 | 0.0224 | 1.626 | -0.007474 | 0.08035 | fixed |
| sibling_count5 | 0.02904 | 0.02499 | 1.162 | -0.01993 | 0.07801 | fixed |
| sibling_count5+ | 0.03525 | 0.02514 | 1.402 | -0.01402 | 0.08452 | fixed |
| sd_(Intercept).mother_pidlink | 0.003056 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2792 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.08294 | 0.2389 | -0.3471 | -0.5513 | 0.3854 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08364 | 0.02531 | 3.305 | 0.03404 | 0.1332 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002862 | 0.0008694 | -3.292 | -0.004566 | -0.001158 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003026 | 0.000009525 | 3.177 | 0.00001159 | 0.00004893 | fixed |
| male | 0.2362 | 0.04156 | 5.683 | 0.1547 | 0.3176 | fixed |
| sibling_count3 | 0.01247 | 0.02145 | 0.5814 | -0.02958 | 0.05452 | fixed |
| sibling_count4 | 0.04025 | 0.02337 | 1.722 | -0.00556 | 0.08606 | fixed |
| sibling_count5 | 0.0282 | 0.02649 | 1.064 | -0.02372 | 0.08012 | fixed |
| sibling_count5+ | 0.02489 | 0.02601 | 0.9569 | -0.02609 | 0.07587 | fixed |
| birth_order_nonlinear2 | -0.009683 | 0.01749 | -0.5536 | -0.04396 | 0.0246 | fixed |
| birth_order_nonlinear3 | -0.01878 | 0.02057 | -0.9128 | -0.05909 | 0.02154 | fixed |
| birth_order_nonlinear4 | -0.01068 | 0.02504 | -0.4265 | -0.05976 | 0.0384 | fixed |
| birth_order_nonlinear5 | 0.01235 | 0.03151 | 0.3919 | -0.0494 | 0.0741 | fixed |
| birth_order_nonlinear5+ | 0.01187 | 0.02963 | 0.4004 | -0.04622 | 0.06995 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2793 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.098 | 0.2399 | -0.4085 | -0.5682 | 0.3722 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08341 | 0.02541 | 3.282 | 0.0336 | 0.1332 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002855 | 0.0008731 | -3.27 | -0.004566 | -0.001144 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003018 | 0.000009567 | 3.155 | 0.00001143 | 0.00004894 | fixed |
| male | 0.2385 | 0.04161 | 5.731 | 0.1569 | 0.32 | fixed |
| count_birth_order2/2 | 0.02927 | 0.03273 | 0.8945 | -0.03487 | 0.09341 | fixed |
| count_birth_order1/3 | 0.01775 | 0.02863 | 0.6201 | -0.03836 | 0.07387 | fixed |
| count_birth_order2/3 | 0.0114 | 0.03194 | 0.3568 | -0.05121 | 0.074 | fixed |
| count_birth_order3/3 | 0.03532 | 0.03424 | 1.031 | -0.0318 | 0.1024 | fixed |
| count_birth_order1/4 | 0.09363 | 0.03488 | 2.684 | 0.02527 | 0.162 | fixed |
| count_birth_order2/4 | 0.0124 | 0.03513 | 0.3529 | -0.05646 | 0.08126 | fixed |
| count_birth_order3/4 | 0.029 | 0.03633 | 0.7981 | -0.04221 | 0.1002 | fixed |
| count_birth_order4/4 | 0.04567 | 0.03891 | 1.174 | -0.0306 | 0.1219 | fixed |
| count_birth_order1/5 | 0.06573 | 0.04413 | 1.49 | -0.02075 | 0.1522 | fixed |
| count_birth_order2/5 | 0.0229 | 0.04788 | 0.4783 | -0.07094 | 0.1167 | fixed |
| count_birth_order3/5 | 0.005765 | 0.04394 | 0.1312 | -0.08035 | 0.09188 | fixed |
| count_birth_order4/5 | 0.06116 | 0.04205 | 1.454 | -0.02127 | 0.1436 | fixed |
| count_birth_order5/5 | 0.02552 | 0.04559 | 0.5598 | -0.06383 | 0.1149 | fixed |
| count_birth_order1/5+ | 0.03691 | 0.03967 | 0.9304 | -0.04085 | 0.1147 | fixed |
| count_birth_order2/5+ | 0.05884 | 0.04275 | 1.376 | -0.02494 | 0.1426 | fixed |
| count_birth_order3/5+ | 0.004336 | 0.0406 | 0.1068 | -0.07523 | 0.0839 | fixed |
| count_birth_order4/5+ | 0.005484 | 0.03915 | 0.1401 | -0.07126 | 0.08223 | fixed |
| count_birth_order5/5+ | 0.07248 | 0.03947 | 1.836 | -0.004882 | 0.1498 | fixed |
| count_birth_order5+/5+ | 0.05185 | 0.02905 | 1.785 | -0.005084 | 0.1088 | fixed |
| sd_(Intercept).mother_pidlink | 0.0000002143 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2794 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 546.4 | 607.3 | -262.2 | 524.4 | NA | NA | NA |
| 12 | 548.3 | 614.7 | -262.2 | 524.3 | 0.124 | 1 | 0.7248 |
| 16 | 554.5 | 643.1 | -261.3 | 522.5 | 1.784 | 4 | 0.7754 |
| 26 | 564.9 | 708.8 | -256.5 | 512.9 | 9.584 | 10 | 0.4777 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.06947 | 0.2387 | -0.291 | -0.5374 | 0.3984 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08058 | 0.02532 | 3.182 | 0.03094 | 0.1302 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002747 | 0.0008703 | -3.156 | -0.004453 | -0.001041 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002892 | 0.000009536 | 3.032 | 0.00001023 | 0.00004761 | fixed |
| male | 0.2456 | 0.04089 | 6.007 | 0.1655 | 0.3258 | fixed |
| sibling_count3 | 0.02061 | 0.02307 | 0.8931 | -0.02461 | 0.06582 | fixed |
| sibling_count4 | 0.01468 | 0.02371 | 0.619 | -0.03179 | 0.06114 | fixed |
| sibling_count5 | 0.001525 | 0.02502 | 0.06093 | -0.04751 | 0.05056 | fixed |
| sibling_count5+ | 0.03133 | 0.02169 | 1.444 | -0.01119 | 0.07385 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2809 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.06945 | 0.2388 | -0.2908 | -0.5375 | 0.3986 | fixed |
| birth_order | 0.0005249 | 0.003441 | 0.1525 | -0.00622 | 0.007269 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0805 | 0.02533 | 3.177 | 0.03085 | 0.1302 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002745 | 0.0008706 | -3.153 | -0.004452 | -0.001039 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002892 | 0.000009539 | 3.032 | 0.00001023 | 0.00004762 | fixed |
| male | 0.2457 | 0.0409 | 6.006 | 0.1655 | 0.3258 | fixed |
| sibling_count3 | 0.02035 | 0.02314 | 0.8797 | -0.02499 | 0.0657 | fixed |
| sibling_count4 | 0.01415 | 0.02397 | 0.5904 | -0.03282 | 0.06112 | fixed |
| sibling_count5 | 0.0006978 | 0.02561 | 0.02725 | -0.04949 | 0.05089 | fixed |
| sibling_count5+ | 0.02945 | 0.02495 | 1.18 | -0.01946 | 0.07836 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.281 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.06587 | 0.2393 | -0.2753 | -0.5349 | 0.4031 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08039 | 0.02539 | 3.166 | 0.03063 | 0.1301 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002747 | 0.0008723 | -3.149 | -0.004457 | -0.001037 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002904 | 0.000009559 | 3.038 | 0.00001031 | 0.00004778 | fixed |
| male | 0.2466 | 0.04095 | 6.022 | 0.1663 | 0.3269 | fixed |
| sibling_count3 | 0.02183 | 0.02363 | 0.9241 | -0.02447 | 0.06814 | fixed |
| sibling_count4 | 0.01509 | 0.02475 | 0.6096 | -0.03342 | 0.06359 | fixed |
| sibling_count5 | 0.000362 | 0.02684 | 0.01349 | -0.05225 | 0.05297 | fixed |
| sibling_count5+ | 0.0223 | 0.02591 | 0.8605 | -0.02848 | 0.07307 | fixed |
| birth_order_nonlinear2 | -0.005389 | 0.01784 | -0.3021 | -0.04035 | 0.02957 | fixed |
| birth_order_nonlinear3 | -0.007488 | 0.0207 | -0.3618 | -0.04805 | 0.03308 | fixed |
| birth_order_nonlinear4 | 0.001033 | 0.02432 | 0.04248 | -0.04663 | 0.0487 | fixed |
| birth_order_nonlinear5 | 0.00444 | 0.03014 | 0.1473 | -0.05463 | 0.06351 | fixed |
| birth_order_nonlinear5+ | 0.0206 | 0.02719 | 0.7578 | -0.03269 | 0.0739 | fixed |
| sd_(Intercept).mother_pidlink | 0.0000001225 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2812 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.0715 | 0.2401 | -0.2978 | -0.5421 | 0.3991 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08093 | 0.02546 | 3.179 | 0.03104 | 0.1308 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002754 | 0.0008747 | -3.148 | -0.004468 | -0.001039 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.000029 | 0.000009585 | 3.026 | 0.00001022 | 0.00004779 | fixed |
| male | 0.2473 | 0.04103 | 6.026 | 0.1669 | 0.3277 | fixed |
| count_birth_order2/2 | -0.01316 | 0.03653 | -0.3603 | -0.08475 | 0.05843 | fixed |
| count_birth_order1/3 | 0.00648 | 0.03199 | 0.2026 | -0.05622 | 0.06918 | fixed |
| count_birth_order2/3 | 0.02276 | 0.03503 | 0.6497 | -0.0459 | 0.09142 | fixed |
| count_birth_order3/3 | 0.02057 | 0.03696 | 0.5564 | -0.05188 | 0.09301 | fixed |
| count_birth_order1/4 | 0.004074 | 0.03622 | 0.1125 | -0.06692 | 0.07506 | fixed |
| count_birth_order2/4 | -0.0125 | 0.0367 | -0.3405 | -0.08443 | 0.05943 | fixed |
| count_birth_order3/4 | 0.01958 | 0.0411 | 0.4763 | -0.06098 | 0.1001 | fixed |
| count_birth_order4/4 | 0.03758 | 0.04186 | 0.8979 | -0.04446 | 0.1196 | fixed |
| count_birth_order1/5 | 0.03448 | 0.0407 | 0.8472 | -0.04529 | 0.1143 | fixed |
| count_birth_order2/5 | -0.06708 | 0.04668 | -1.437 | -0.1586 | 0.02441 | fixed |
| count_birth_order3/5 | -0.01311 | 0.0456 | -0.2876 | -0.1025 | 0.07626 | fixed |
| count_birth_order4/5 | 0.01589 | 0.04613 | 0.3446 | -0.07451 | 0.1063 | fixed |
| count_birth_order5/5 | -0.01125 | 0.04681 | -0.2404 | -0.103 | 0.08049 | fixed |
| count_birth_order1/5+ | 0.01485 | 0.03818 | 0.3891 | -0.05998 | 0.08969 | fixed |
| count_birth_order2/5+ | 0.0675 | 0.04056 | 1.664 | -0.012 | 0.147 | fixed |
| count_birth_order3/5+ | -0.009537 | 0.03866 | -0.2467 | -0.08532 | 0.06624 | fixed |
| count_birth_order4/5+ | -0.005476 | 0.03705 | -0.1478 | -0.07809 | 0.06714 | fixed |
| count_birth_order5/5+ | 0.03103 | 0.03971 | 0.7813 | -0.0468 | 0.1089 | fixed |
| count_birth_order5+/5+ | 0.03933 | 0.03021 | 1.302 | -0.01988 | 0.09853 | fixed |
| sd_(Intercept).mother_pidlink | 0 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2812 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 575.8 | 636.8 | -276.9 | 553.8 | NA | NA | NA |
| 12 | 577.8 | 644.3 | -276.9 | 553.8 | 0.02339 | 1 | 0.8784 |
| 16 | 584.7 | 673.3 | -276.3 | 552.7 | 1.123 | 4 | 0.8905 |
| 26 | 594.9 | 739 | -271.4 | 542.9 | 9.793 | 10 | 0.4588 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.04607 | 0.2413 | -0.1909 | -0.519 | 0.4269 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.0834 | 0.02552 | 3.267 | 0.03337 | 0.1334 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002838 | 0.0008763 | -3.239 | -0.004556 | -0.001121 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002979 | 0.00000959 | 3.107 | 0.000011 | 0.00004859 | fixed |
| male | 0.2043 | 0.04246 | 4.81 | 0.121 | 0.2875 | fixed |
| sibling_count3 | 0.002244 | 0.02053 | 0.1094 | -0.03798 | 0.04247 | fixed |
| sibling_count4 | 0.01715 | 0.02185 | 0.7848 | -0.02568 | 0.05997 | fixed |
| sibling_count5 | 0.01547 | 0.02478 | 0.6244 | -0.0331 | 0.06405 | fixed |
| sibling_count5+ | 0.01676 | 0.02088 | 0.8027 | -0.02417 | 0.05769 | fixed |
| sd_(Intercept).mother_pidlink | 0.0000001348 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2794 | NA | NA | NA | NA | Residual |
plot(allEffects(m1_covariates_only))

tidy(m2_birthorder_linear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.04579 | 0.2414 | -0.1897 | -0.5188 | 0.4272 | fixed |
| birth_order | -0.001402 | 0.004028 | -0.3481 | -0.009298 | 0.006493 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08359 | 0.02554 | 3.273 | 0.03354 | 0.1336 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002842 | 0.0008765 | -3.242 | -0.00456 | -0.001124 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00002977 | 0.000009593 | 3.103 | 0.00001097 | 0.00004857 | fixed |
| male | 0.2039 | 0.04248 | 4.799 | 0.1206 | 0.2871 | fixed |
| sibling_count3 | 0.002897 | 0.02062 | 0.1405 | -0.03751 | 0.0433 | fixed |
| sibling_count4 | 0.01871 | 0.02231 | 0.8385 | -0.02502 | 0.06243 | fixed |
| sibling_count5 | 0.01788 | 0.02573 | 0.6947 | -0.03256 | 0.06831 | fixed |
| sibling_count5+ | 0.0218 | 0.02541 | 0.8578 | -0.02801 | 0.07161 | fixed |
| sd_(Intercept).mother_pidlink | 0.0000001197 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2795 | NA | NA | NA | NA | Residual |
plot_birthorder2(m2_birthorder_linear, separate = FALSE, ylimits = ylimits)

m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.04889 | 0.2419 | -0.2021 | -0.523 | 0.4252 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08412 | 0.0256 | 3.286 | 0.03395 | 0.1343 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002866 | 0.0008787 | -3.262 | -0.004588 | -0.001144 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003016 | 0.000009617 | 3.136 | 0.00001131 | 0.00004901 | fixed |
| male | 0.2047 | 0.04253 | 4.812 | 0.1213 | 0.288 | fixed |
| sibling_count3 | 0.004311 | 0.0211 | 0.2044 | -0.03704 | 0.04566 | fixed |
| sibling_count4 | 0.01953 | 0.02331 | 0.8379 | -0.02615 | 0.06521 | fixed |
| sibling_count5 | 0.01357 | 0.02714 | 0.5 | -0.03962 | 0.06676 | fixed |
| sibling_count5+ | 0.01085 | 0.02636 | 0.4114 | -0.04083 | 0.06252 | fixed |
| birth_order_nonlinear2 | -0.01028 | 0.01744 | -0.5894 | -0.04446 | 0.0239 | fixed |
| birth_order_nonlinear3 | -0.01277 | 0.02068 | -0.6177 | -0.0533 | 0.02776 | fixed |
| birth_order_nonlinear4 | -0.003305 | 0.02593 | -0.1275 | -0.05412 | 0.04751 | fixed |
| birth_order_nonlinear5 | 0.01257 | 0.03247 | 0.3873 | -0.05106 | 0.0762 | fixed |
| birth_order_nonlinear5+ | 0.008002 | 0.03061 | 0.2614 | -0.052 | 0.068 | fixed |
| sd_(Intercept).mother_pidlink | 0.0000001198 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2797 | NA | NA | NA | NA | Residual |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE, ylimits = ylimits)

m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
| term | estimate | std.error | statistic | conf.low | conf.high | group |
|---|---|---|---|---|---|---|
| (Intercept) | -0.0656 | 0.2431 | -0.2698 | -0.5421 | 0.4109 | fixed |
| poly(age, 3, raw = TRUE)1 | 0.08471 | 0.02575 | 3.29 | 0.03425 | 0.1352 | fixed |
| poly(age, 3, raw = TRUE)2 | -0.002891 | 0.000884 | -3.27 | -0.004623 | -0.001158 | fixed |
| poly(age, 3, raw = TRUE)3 | 0.00003046 | 0.000009677 | 3.148 | 0.0000115 | 0.00004943 | fixed |
| male | 0.2065 | 0.04261 | 4.845 | 0.1229 | 0.29 | fixed |
| count_birth_order2/2 | 0.01718 | 0.03204 | 0.5362 | -0.04562 | 0.07998 | fixed |
| count_birth_order1/3 | 0.005085 | 0.02819 | 0.1804 | -0.05016 | 0.06033 | fixed |
| count_birth_order2/3 | 0.0003569 | 0.03145 | 0.01135 | -0.06129 | 0.062 | fixed |
| count_birth_order3/3 | 0.02669 | 0.03354 | 0.7957 | -0.03905 | 0.09243 | fixed |
| count_birth_order1/4 | 0.06555 | 0.0353 | 1.857 | -0.003631 | 0.1347 | fixed |
| count_birth_order2/4 | -0.01125 | 0.03483 | -0.323 | -0.07952 | 0.05702 | fixed |
| count_birth_order3/4 | 0.01287 | 0.03668 | 0.3507 | -0.05903 | 0.08476 | fixed |
| count_birth_order4/4 | 0.02968 | 0.03883 | 0.7645 | -0.04641 | 0.1058 | fixed |
| count_birth_order1/5 | 0.04971 | 0.0441 | 1.127 | -0.03673 | 0.1361 | fixed |
| count_birth_order2/5 | 0.02667 | 0.04994 | 0.534 | -0.07122 | 0.1246 | fixed |
| count_birth_order3/5 | -0.01025 | 0.04789 | -0.2141 | -0.1041 | 0.08361 | fixed |
| count_birth_order4/5 | 0.0333 | 0.04609 | 0.7225 | -0.05703 | 0.1236 | fixed |
| count_birth_order5/5 | 0.004253 | 0.04725 | 0.09001 | -0.08835 | 0.09685 | fixed |
| count_birth_order1/5+ | 0.01471 | 0.04019 | 0.3659 | -0.06407 | 0.09348 | fixed |
| count_birth_order2/5+ | 0.03404 | 0.04497 | 0.757 | -0.0541 | 0.1222 | fixed |
| count_birth_order3/5+ | -0.01059 | 0.0404 | -0.262 | -0.08976 | 0.06859 | fixed |
| count_birth_order4/5+ | 0.007186 | 0.04081 | 0.1761 | -0.07281 | 0.08718 | fixed |
| count_birth_order5/5+ | 0.05585 | 0.04037 | 1.384 | -0.02326 | 0.135 | fixed |
| count_birth_order5+/5+ | 0.0298 | 0.02955 | 1.009 | -0.02811 | 0.08771 | fixed |
| sd_(Intercept).mother_pidlink | 0.0000001199 | NA | NA | NA | NA | mother_pidlink |
| sd_Observation.Residual | 0.2799 | NA | NA | NA | NA | Residual |
plot_birthorder(m4_interaction, ylimits = ylimits)

###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
| Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
|---|---|---|---|---|---|---|---|
| 11 | 539.4 | 600.1 | -258.7 | 517.4 | NA | NA | NA |
| 12 | 541.3 | 607.5 | -258.7 | 517.3 | 0.1219 | 1 | 0.727 |
| 16 | 548.3 | 636.5 | -258.2 | 516.3 | 0.9801 | 4 | 0.9128 |
| 26 | 561 | 704.3 | -254.5 | 509 | 7.335 | 10 | 0.6935 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
